I am having an issue I can't seem to sort out and after looking through the site I didn't see my exact issue so here we go.
I have a PC with multiple NIC adapters. One is set to 192.168.6.1 and the other is set to 192.168.2.90, both have the same subnet mask of 255.255.0.0. Both NICs are plugged into the same network switch (not managed, just a 32 port switch). Residing on the same network are multiple PCs with the same subnet mask but differing IP addresses in the 192.168.6.X range (192.168.6.6 , 192.168.6.7, etc)
I have an application running on the PC with multiple NIC adapters and it is binding and joining a multicast group to receive packets. The issue I am having is that the multicast packets that are being sent from one of the PCs in the system (i.e. 192.168.6.6) are not being received by my application. I can see the multicast packets in Wireshark when viewing either NIC's traffic so I believe that each NIC is getting the packets properly.
A small snippet:
{
IPEndPoint localIPEndPoint
localIPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.6.1"), 16466);
receiveUDPClient = new UdpClient(localIPEndPoint);
receiveUDPClient.JoinMulticastGroup(IPAddress.Parse("239.254.2.1"));
receiveUDPClient.MulticastLoopback = false;
receiveUDPClient.DontFragment = true;
receiveUDPClient.Client.ReceiveBufferSize = 16384;
// ....
// ....
BeginReceiveAudio();
}
public void BeginReceiveAudio()
{
receiveUDPClient.BeginReceive(ReceiveCallback, receiveUDPClient);
}
I am processing the packets in a callback which I know works fine when using a single NIC -- in fact if I simply disable the 192.168.2.90 NIC adapter my application receives the packets just fine.
private void ReceiveCallback(IAsyncResult ar)
{
byte[] receivedBytes = receiveUDPClient.EndReceive(ar, ref localIPEndPoint);
// Process Data...
BeginReceiveAudio();
}
The other interesting thing is that if I swap the IP addresses of the adapter's while both enabled, my application receives the packets just fine! I am not at all familiar with how the packets get routed to each NIC; I assumed that when you bind to an IP Address and join a multicast group, any packets transmitted to that multicast group get received by the PC are routed to each NIC that is a part of that multicast group.
Any clue whats going on here? Given that it's one common network, what would be the reason that using one NIC lets my application recieve the packets but the other doesn't?