Hey, I am trying to write a client which gets data from multicast_v4.
and join the multicast_v4 successful.. and I can capture data by tcpdump,
but I can't get data in my socket buf
. it confused me.
this is the UDP-socket-created demo, notice it's just a demo code and it's a solarflare card .
and sadly, I can't provide a testing server for some reason.
fn main() {
let tick_udp_port = 0;
let addrs = [SocketAddr::from(([0, 0, 0, 0], tick_udp_port))];
let socket = UdpSocket::bind(&addrs[..]).unwrap();
socket.set_nonblocking(true).unwrap();
let remote_addr = "233.32.2.22:32200";
let addr: SocketAddr = remote_addr
.to_socket_addrs()
.unwrap()
.next()
.unwrap();
match addr.ip() {
IpAddr::V4(ip) => socket
.join_multicast_v4(&ip, &Ipv4Addr::UNSPECIFIED)
.unwrap(),
IpAddr::V6(_) => unreachable!("IPV6 found. not supported by RemAPI"),
};
let buf = BufferedUdp::new(socket);
let mut udp = Udp { tick_buffered: buf };
loop {
if let Ok(Some(x)) = udp.next_tick_response() {
match x {
ResponseMessage::TickLevel2(_x) => {
println!("vec l2")
}
_ => unreachable!()
}
};
}
}
I want to ask if there are some factors that cause this problem.