_ 2021-12-05 20:16:47 +00:00
parent fa7300b069
commit 8e5e15471b
1 changed files with 2 additions and 0 deletions

View File

@ -140,6 +140,7 @@ fn server () -> Result <(), AppError> {
socket.join_multicast_v4 (&params.multicast_addr, &([0u8, 0, 0, 0].into ())).unwrap ();
loop {
println! ("Waiting for messages...");
let (req, remote_addr) = recv_msg_from (&socket)?;
let resp = match req {
@ -159,6 +160,7 @@ fn recv_msg_from (socket: &UdpSocket) -> Result <(Message, SocketAddr), AppError
{
let mut buf = vec! [0u8; PACKET_SIZE];
let (bytes_recved, remote_addr) = socket.recv_from (&mut buf)?;
dbg! (remote_addr);
buf.truncate (bytes_recved);
let msg = Message::from_slice (&buf)?;