Replies: 2 comments 2 replies
-
You can use the socket2 methods on a Tokio socket. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, EDIT: for future reference, here is an example of how to do it: https://github.com/henninglive/tokio-udp-multicast-chat/blob/master/src/main.rs#L29 beware that the socket2 version used is an old one and |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am setting up an IPv6 Multicast server and client and I noticed that neither tokio::net::UdpSocket neither the std::net::UdpSocket provide a way to set the multicast interface as it is done in the socket2 crate: https://docs.rs/socket2/latest/socket2/struct.Socket.html#method.set_multicast_if_v6
As far as I know, the server is required to join the multicast group, whilst the client doesnt. The client needs just to specify the interface that wants to use to send the multicast packets from and when calling the
send_to
function, specify the remote address which shall be the concatenation of the multicast group address and the port.However, due to the underlying UdpSocket API of tokio, we are forced to use the
join_multicast_v6
method. Is this correct?Shouldnt we have a way to set the multicast if the client wants to use without joining the interface to the multicast group?
An example of it should look like using socket2 crate is provided here: https://github.com/bluejekyll/multicast-example/blob/master/src/lib.rs#L161
Beta Was this translation helpful? Give feedback.
All reactions