Receving multiple multicast feeds on the same port - C, Linux
Posted
by Gigi
on Stack Overflow
See other posts from Stack Overflow
or by Gigi
Published on 2010-04-30T00:26:49Z
Indexed on
2010/04/30
0:47 UTC
Read the original article
Hit count: 271
I have an application that is receiving data from multiple multicast sources on the same port. I am able to receive the data. However, I am trying to account for statistics of each group (i.e. msgs received, bytes received) and all the data is getting mixed up. Does anyone know how to solved this problem? If I try to look at the sender's address, it is not the multicast address, but rather the IP of the sending machine.
I am using the following socket options:
struct ip_mreq mreq;
mreq.imr_multiaddr.s_addr = inet_addr("224.1.2.3");
mreq.imr_interface.s_addr = INADDR_ANY;
setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
and also:
setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &reuse, sizeof(reuse));
I appreciate any help!!!
© Stack Overflow or respective owner