January 04, 2011
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
http://www.cs.unc.edu/~jeffay/dirt/FAQ/comp249-001-F99/mcast-socket.html)
and can't find within the library.

Let's assume I am trying to listen to 225.0.0.37/12345

Can someone help me with a snippet on some d code that will do this?

I appreciate the help!

Peter



auto socket = new UdpSocket();
auto address = new InternetAddress(12345);
socket.bind(address);
auto multicastAddress = new InternetAddress("225.0.0.37");

/// The below naturally does not work and I can't seem to find

// How do I join the multicast address above?

byte[256] buffer;
int read = socket.receiveFrom(buffer);
printf("Received bytes %i", read);
return 0;