Hina
Hina

Reputation: 13

c# : UDPClient not receiving multicast from one of the Network Adapters

I would like to test Receive of multicast messages using UDP Client

I have two network adapters.

Network 1: with local IP : 10.239.1.1 [Multicast Group : 224.1.1.1 : 42333]

Network 2 : with local IP : 172.4.1.1 [Multicast Group : 224.0.1.1 : 42333]

Note : I can see all the multicast on wire shark

In my program I created and joined the multicast group as bellow.

    _LocalUDPClient = new UdpClient(new IPEndPoint(_localIpAddress, _multiCastPort));
    _LocalUDPClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);

    _LocalUDPClient.JoinMulticastGroup(_multicastIpAddress, _localIpAddress);

    _LocalUDPClient.BeginReceive(new AsyncCallback(ReceiveCallBack), null);

Network 1 :

     _localIpAddress = 10.239.1.1
     _multicastIpAddress = 224.1.1.1
     _multiCastPort = 42333

I receive multicast message successfully.

BUT Network 2 :

     _localIpAddress = 172.4.1.1
     _multicastIpAddress = 224.0.1.1
     _multiCastPort = 42333

Not receiving any Multicast data.

Upvotes: 0

Views: 170

Answers (1)

Hina
Hina

Reputation: 13

It is not a c# code issue, It is Firewall issue. open firewall and network protection under system settings You should be able to see your .exe under "Allow an app through firewall".

In my case I can see it 3 times with different settings. I deleted all and added manually my program .exe with allow for all network types, I got multicasts now.

Upvotes: 0

Related Questions