mirror of
https://gitea.farpn.net/w1cdn/mwtchahrd.git
synced 2025-10-13 04:48:42 -05:00
Send a UDP message to the server that says you are connected.
This commit is contained in:
10
src/main.rs
10
src/main.rs
@ -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 {
|
||||
|
Reference in New Issue
Block a user