I have an app that uses 2 multicast channels, so
_sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint iep = new IPEndPoint(IPAddress.Any, 30002);
_sock.Bind(iep);
_sock.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.255.0.2")));
...
later on, in the same app
_sock2 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint iep = new IPEndPoint(IPAddress.Any, 30001);
_sock2.Bind(iep);
_sock2.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.255.0.2")));
(notice the different ports).
When the execution point reaches the second bind an exception (HResult 0x80004005) is raised, warning me that only one protocol/address/port can be used...
I have done that in C++ apps so i think ther must be an error.
What is wrong with that?
Thank you in advance