IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, 111);
Socket s = new Socket(endPoint.Address.AddressFamily,
SocketType.Dgram,
ProtocolType.Udp);
//// Creates an IPEndPoint to capture the identity of the sending host.
//IPEndPoint sender = new IPEndPoint(IPAddress.Parse("230.1.1.1"), 111);
//EndPoint senderRemote = (EndPoint)sender;
// Binding is required with ReceiveFrom calls.
s.Bind(endPoint);
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("230.1.1.1")));
byte[] msg = new Byte[2506];
Console.WriteLine("Waiting to receive datagrams from client...");
// This call blocks.
EndPoint ep = (EndPoint)endPoint;
int count = s.ReceiveFrom(msg, ref ep);