Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - One host listening to multiple multi-cast addresses: (1 Item)
   
One host listening to multiple multi-cast addresses  
Hello,

In my host (a x86 based board running on QNX 6.5), there is a need to be able to listen to network packets coming over 
different multi-cast addresses but the same physical ethernet link. For example, my host should be able to listen to 
packets coming on multi-cast addresses (224.0.0.1 & 224.0.0.2). 

To listen to packets on a single multi-cast address, we used the setsockopt() call with IP_ADD_MEMBERSHIP option & gave 
the appropriate multi-cast address. Now can I make multiple setsockopt() calls for each of the different multi-cast 
addresses so that my socket is capable of listening to packets on all these multi-cast addresses?

For example, here's a sample code:

// Begin Sample code
struct ip_mreq mreq1;
struct ip_mreq mreq2;

setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq1, sizeof(mreq1));
setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq2, sizeof(mreq2));

// End of sample code

I am hoping that the second setsockopt() call does not over-write the options set using the 1st setsockopt() call.

Any help on this will be appreciated.

Regards
Sunil Keshava