digitalmars.D.learn - joining multicast groups with std.socket
- Peter Ryan (20/20) Jan 04 2011 I am trying to listen to a multicast group using the std.socket library....
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 220.127.116.11/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("18.104.22.168"); /// The below naturally does not work and I can't seem to find // How do I join the multicast address above? byte buffer; int read = socket.receiveFrom(buffer); printf("Received bytes %i", read); return 0;
Jan 04 2011