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

给你一囗甜甜゛ 提交于 2019-12-22 09:49:14

问题


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 setsockopt, but I am not sure how to do this in Haskell. Can anyone help with this? Thanks!


回答1:


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.



来源:https://stackoverflow.com/questions/6111204/how-to-specify-a-local-bond-interface-to-multicast-socket-in-haskell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!