简体   繁体   中英

UDPClient not receiving multicast data C# ASP.net

Yesterday my C# ASP.net application worked great and I was receiving UDP multicast data no problems.

Today, our server was down (unknown reason), so we rebooted it.

We re-added the routes using the route ADD command (not sure how they were lost to begin with)

We see the data coming to our NIC, and the NIC sees the UDP packets information as provided by MS server 2012 Remote Access and Routing information.

However, the C# Application no longer receives any data. The data arrives to the NIC, but doesn't seem to make it to the application.

My code is as follows for the UDP listener.

 UdpClient client = new UdpClient();
                IPAddress newaddress = IPAddress.Parse(anOPRA.RTMultiCastGroup[multicastCount, 0]);
                multiport = int.Parse( anOPRA.RTMultiCastGroup[multicastCount,1]);
                IPEndPoint localEp_time = new IPEndPoint(localIP, multiport);
                client.ExclusiveAddressUse = false;
                client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
                client.ExclusiveAddressUse = false;
                client.DontFragment = true;
                myDataHub.Send("BufferSize ", client.Client.ReceiveBufferSize.ToString());

                client.Client.Bind(localEp_time);
                 client.JoinMulticastGroup(newaddress);

Any ideas what could be wrong, this is so frustrating I can't figure it out.

Are you running in debug mode? If so, try running in release mode. I had the same issue (I'm using VS2012 Express) and this resolved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM