<meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">I am trying to listen to a multicast group using the std.socket library. I have looked at the documentation but I do not see a way to join a multicast group. The code I have so far is pasted below. I am looking for the IP_ADD_MEMBERSHIP socket option (along the lines of <a href="http://www.cs.unc.edu/~jeffay/dirt/FAQ/comp249-001-F99/mcast-socket.html" target="_blank" style="color: rgb(51, 51, 204); ">http://www.cs.unc.edu/~jeffay/dirt/FAQ/comp249-001-F99/mcast-socket.html</a>) and can't find within the library.<div>
<br></div><div>Let's assume I am trying to listen to <a href="http://225.0.0.37/12345" target="_blank" style="color: rgb(51, 51, 204); ">225.0.0.37/12345</a></div><div><br></div><div>Can someone help me with a snippet on some d code that will do this? </div>
<div><br></div><div>I appreciate the help!</div><div><br></div><div>Peter</div><div><br></div><div><br></div><div><div><br></div><div><div>auto socket = new UdpSocket();</div><div>auto address = new InternetAddress(12345);</div>
<div>socket.bind(address);</div><div><span style="white-space: pre-wrap; ">   </span></div><div>auto multicastAddress = new InternetAddress("225.0.0.37");</div><div><br></div><div>/// The below naturally does not work and I can't seem to find </div>
<div><br></div><div>// How do I join the multicast address above?</div><div><br></div><div>byte[256] buffer;</div><div>int read = socket.receiveFrom(buffer);</div><div>printf("Received bytes %i", read); </div><div>
return 0;</div></div></div></span>