audreyt / network-multicast

[Haskell] The "Network.Multicast" module is for sending UDP datagrams over multicast (class D) addresses.
http://github.com/audreyt/network-multicast
Other
23 stars 12 forks source link

SO_REUSEPORT is defined on Linux, but cannot be used #5

Closed joeyh closed 11 years ago

joeyh commented 11 years ago

Prelude Network.Multicast> multicastReceiver "224.0.0.99" 9999 *\ Exception: user error (Network.Socket.setSocketOption: socket option ReusePort unsupported on this system)

Linux 3.2.x did not define SO_REUSEPORT in asm-generic/socket.h, but Linux 3.10 does, and so network-multicast tries to use it. But this is apparently not actually supported by linux (or possibly by glibc 2.17 which I am using.

I noticed this when I reinstalled network-socket. My old build was done with the headers from Linux 3.2.x, and worked. The new one, built from the same source code, failed.

I have worked around this by changing the code like this:

- #ifdef SO_REUSEPORT
+ #if defined(SO_REUSEPORT) && ! defined (__linux__)
audreyt commented 11 years ago

Thanks! Merged and released at network-multicast-0.0.8.