using System;
using System.Net;
using System.Net.Sockets;
namespace grof.protocols.membership{
/// <summary>
/// The <c>ReusableUdpClient</c> is able to
/// receive UDP messages from a multicast group.
/// Furthermore several clients on the same machine
/// can be bound to the
/// same multicast group.
/// </summary>
class ReusableUdpClient : UdpClient
{
/// <summary>
/// Creates instances of class <c>ReusableUdpClient</c>.
/// </summary>
/// <param name="port">The port of the multicast group.</param>
public ReusableUdpClient ( int port ) : base()
{
Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReuseAddress,
1);
Client.Bind(new IPEndPoint(IPAddress.Any, port));
}
}
}
|