N
Nuno Magalhaes
I'm trying to set a multicast server but I get "Invalid argument" when
setting multicast options.
Below is the code that gives me problems more precisely in
SetSocketOption with the AddMembership name... it exits with a runtime
error telling me "An invalid argument was supplied". Does anyone know
how to fix this?
-------------------------------
public MulticastServer(string IPAddressString)
{
//Create multicast socket
socket=new
Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);
IPAddress ip=IPAddress.Parse(IPAddressString);
socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.AddMembership,new
MulticastOption(ip));
socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.MulticastTimeToLive,2);
IPEndPoint ep=new IPEndPoint(ip,5000);
//socket.Connect(ep);
}
setting multicast options.
Below is the code that gives me problems more precisely in
SetSocketOption with the AddMembership name... it exits with a runtime
error telling me "An invalid argument was supplied". Does anyone know
how to fix this?
-------------------------------
public MulticastServer(string IPAddressString)
{
//Create multicast socket
socket=new
Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);
IPAddress ip=IPAddress.Parse(IPAddressString);
socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.AddMembership,new
MulticastOption(ip));
socket.SetSocketOption(SocketOptionLevel.IP,SocketOptionName.MulticastTimeToLive,2);
IPEndPoint ep=new IPEndPoint(ip,5000);
//socket.Connect(ep);
}