I am trying to implement some Source-Specific Multicasting in c# (mainly to be free to pick any group address over the internet without risking any conflict). I followed that method, but I keep running into an error :
an unknown invalid or unsupported option or level was specified in a getsockopt or setsockopt call
This is a classical error that happens for example when you specify a SocketOptionLevel which is inconsistent with the SocketOptionName. Yet I checked that I use SocketOptionLevel.IP, which is the right one for multicasting options. I also tried the other ones, which raise the same error. Have you got any idea about what else could raise this exception, or what am I doing wrong ?
Here is my code :
mySocket = UdpClient(localEndPoint);
Buffer.BlockCopy(multicastGroupAddress.GetAddressBytes(), 0, membershipAddresses, 0, 4);
Buffer.BlockCopy(remoteEndPoint.Address.GetAddressBytes(), 0, membershipAddresses, 4, 4);
Buffer.BlockCopy(localEndPoint.Address.GetAddressBytes(), 0, membershipAddresses, 8, 4);
mySocket.Client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddSourceMembership, membershipAddresses);
(Yes, obviously copied from the link, I am still trying to make it work)
Thanks !