<div>Hello,</div>
<div> </div>
<div>I am relatively new user to the Live Media library. In our application, we would like to bind to a multicast address in addition to binding to the local port number. This is so that we *only* receive packets destined for a given
<u>Multicast address & port</u> combination and prevent other datagrams destined for that same port from being deliverd to our socket.</div>
<div> </div>
<div>To achieve this, I am using "ReceivingInterfaceAddr" global variable to set our MULTICAST address. This allows Groupsock to bind to this address, however following code in the GroupsockHelper.cpp fails:</div>
<div> </div>
<div>// socketJoinGroup() code snippet </div>
<div>imr.imr_multiaddr.s_addr = groupAddress;<br> imr.imr_interface.s_addr = ReceivingInterfaceAddr;<br> if (setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,<br> (const char*)&imr, sizeof (struct ip_mreq)) < 0) {
</div>
<div> </div>
<div>This is because ReceivingInterfaceAddr being a Multicast address, is not a valid interface address. </div>
<div> </div>
<div>However, if the above one line was modified as follows to use the INADDR_ANY as the interface address when ReceivingInterfaceAddr is a multicast address, it should work:</div>
<div> </div>
<div>// change imr.imr_interface.s_addr = ReceivingInterfaceAddr; to following:</div>
<div> </div>
<div>if (IN_MULTICAST(ntohl(ReceivingInterfaceAddr))) {<br> // Bound to MULTICAST Address, so use INADDR_ANY as the i/f address<br> imr.imr_interface.s_addr = INADDR_ANY;<br> }<br> else {<br> // Bound to UNICAST Address, so use this address as the i/f address
<br> imr.imr_interface.s_addr = ReceivingInterfaceAddr;<br> }<br> </div>
<div>This simple change enables applications interested in receiving specific packets only. </div>
<div> </div>
<div>Here are my questions:</div>
<ol>
<li>Is this an acceptable solution to my problem? If so, can this change be included in your code base and future release?</li>
<li>If not, is there an existing solution to this problem?</li></ol>
<div>I will sincerely appreciate any input and guidance on this issue. </div>
<div> </div>
<div>Best regards,</div>
<div>-Sanjeev</div>
<p> </p>
<div> </div>