开发者

How to specify a local bond interface to multicast socket in Haskell?

I have tried Network.Multicast package and it does work, however, I cannot find a way to specify a local bond interface ("bond0" or "bond1" etc) to the multicast socket. I know in C I need to use ioctl to convert the bond into a struct sockaddr_in, then feed this struct to IP_MULTICAST_IF option under IPPROTO_IP family of setso开发者_运维问答ckopt, but I am not sure how to do this in Haskell. Can anyone help with this? Thanks!


In the source of network-multicast [1] I see a call to set ip_multicast_if in the setInterface function. It is always called with the result of inet_addr on the host string you pass in.

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

I would imagine that you need to write your own ffi bindings and function to do what you want. But it should be straightforward to do so based on the code in network-multicast, and I'm sure that once you do so it would be a welcome patch to the library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜