wip
parent
fa7300b069
commit
8e5e15471b
|
@ -140,6 +140,7 @@ fn server () -> Result <(), AppError> {
|
||||||
socket.join_multicast_v4 (¶ms.multicast_addr, &([0u8, 0, 0, 0].into ())).unwrap ();
|
socket.join_multicast_v4 (¶ms.multicast_addr, &([0u8, 0, 0, 0].into ())).unwrap ();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
println! ("Waiting for messages...");
|
||||||
let (req, remote_addr) = recv_msg_from (&socket)?;
|
let (req, remote_addr) = recv_msg_from (&socket)?;
|
||||||
|
|
||||||
let resp = match req {
|
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 mut buf = vec! [0u8; PACKET_SIZE];
|
||||||
let (bytes_recved, remote_addr) = socket.recv_from (&mut buf)?;
|
let (bytes_recved, remote_addr) = socket.recv_from (&mut buf)?;
|
||||||
|
dbg! (remote_addr);
|
||||||
buf.truncate (bytes_recved);
|
buf.truncate (bytes_recved);
|
||||||
let msg = Message::from_slice (&buf)?;
|
let msg = Message::from_slice (&buf)?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue