<div><font color="#000000">I'm using liveMedia to build a simple Streaming Server,</font></div>
<div><font color="#000000">and I found there's problem with the socketJoinGroupSSM(...) on WIN32 system, that the sourceFilterAddr should set by IP_MULTICAST_IF, not IP_ADD_MEMBERSHIP.</font></div>
<div> </div>
<div>So I changed it like this:</div>
<div> </div>
<div><font color="#000066">Boolean socketJoinGroupSSM(UsageEnvironment& env, int socket,<br> netAddressBits groupAddress,<br> netAddressBits sourceFilterAddr) {<br> if (!IsMulticastAddress(groupAddress)) return True; // ignore this case
<br>#if defined(__WIN32__) || defined(_WIN32)<br>/**Here Add Win32 Operations By SHENMC 20060303*/<br> struct ip_mreq imr;<br> 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) {<br> if (env.getErrno() != 0) {<br> // That piece-of-shit toy operating system (Windows) sometimes lies
<br> // about setsockopt() failing!<br> socketErr(env, "setsockopt(IP_ADD_MEMBERSHIP) error: ");<br> return False;<br> }<br> }<br> /**In Win32 system, the sourceFilterAddr should set by IP_MULTICAST_IF */
<br> if(setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF,<br> (char *)&sourceFilterAddr,<br> sizeof(sourceFilterAddr)) < 0)<br> {<br> socketErr(env, "setsockopt(IP_MULTICAST_IF) error: ");<br> }<br> return True;
<br>#else /*NOT WIN32*/<br> struct ip_mreq_source imr;<br> imr.imr_multiaddr.s_addr = groupAddress;<br> imr.imr_sourceaddr.s_addr = sourceFilterAddr;<br> imr.imr_interface.s_addr = ReceivingInterfaceAddr;<br> if (setsockopt(socket, IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP,
<br> (const char*)&imr, sizeof (struct ip_mreq_source)) < 0) {<br> socketErr(env, "setsockopt(IP_ADD_SOURCE_MEMBERSHIP) error: ");<br> return False;<br> }<br> return True;<br>#endif<br>}</font><br clear="all">
</div>
<div> </div>
<div>And it can work correctly.<br>-- <br>Aliex Shen, From the world. </div>