How to specify local communication interface for multicast socket in Haskell?

I tried the Network.Multicast package, but it works, however I cannot find a way to specify the local communication interface ("bond0" or "bond1", etc.) in the multicast socket. I know that in C I need to use ioctl to convert the connection to struct sockaddr_in, and then pass this structure to the IP_MULTICAST_IF parameter in the IPPROTO_IP setsockopt family, but I'm not sure how to do this in Haskell. Can anyone help with this? Thank!

+3
source share
1 answer

In the network multicast source [1], I see a call to set ip_multicast_if in the setInterface function. It is always called with the result inet_addron the host line that you pass into.

[1] http://hackage.haskell.org/packages/archive/network-multicast/0.0.6/doc/html/src/Network-Multicast.html

I would suggest that you need to write your own ffi bindings and functions in order to do what you want. But it should just be done based on code on a multicast network, and I'm sure that once you do this, this will be a welcome patch for the library.

+1
source

All Articles