Advanced Topics for Internet Datagram Sockets
Sending and Receiving IP Multicast Datagrams
Note that imr_interface must match the field that was used when the
IP_ADD_MEMBERSHIP socket option was specified for
imr_multiaddr.
Sharing a Multicast Port SO_REUSEPORT
If more than one application may bind to the same port number on a
system, each application must set the SO_REUSEPORT socket option
before binding to the port. For example:
#include <netinet/in.h>
int reuse = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &reuse, sizeof(reuse));
120
Chapter 5