Send a UDP message to the server that says you are connected.

This commit is contained in:
mattbk
2025-10-12 21:06:49 -05:00
parent 7957fa7c2c
commit 98da8b95d5

View File

@@ -406,6 +406,7 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) {
"summary": &summary,
"text": &text,
"timestamp": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),
"type": "data"
});
let _ = socket.expect("REASON").send_to(packet.to_string().as_bytes(), uaddr);
}
@@ -437,8 +438,13 @@ fn main() -> Result<()> {
let socket = UdpSocket::bind("0.0.0.0:0")?;
println!("UDP client started at {}:{}", cli.uip, cli.uport);
// Send a message to the server
let message = "UDP client connected";
socket.send_to(message.as_bytes(), uaddr)?;
let packet = json!({
"text": "UDP client connected",
"timestamp": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(),
"type": "status"
});
//let message = "UDP client connected";
socket.send_to(packet.to_string().as_bytes(), uaddr)?;
}
loop {