开发者

C# - WireShark detects incomming packets but application does not receive them

I've got a strange problem. I have a client sending packets to my server, but my servers UDP socket never receives them. Same thing happens the other way around, if I send and he tries to receive.

Check this image, captured from wireshark: http://img263.imageshack.us/img263/2636/bokus.png

I h开发者_如何学JAVAav bound my UDP socket to EndPoint 192.168.2.3, which is the internal IP of the server, and port 9998. The client sends data to my IP, which should then be forwarded to the local server machine.. As you can see wireshark clearly detects incomming packets for 192.168.2.3 with destination port 9998 but nothing gets delivered!

(...why does it say distinct32 btw in destination port?)


Something else to watch for is make sure any firewall you might running has a rule setup to allow communications on your port 9998.

If I had to guess (would need to see your recieving C# code to know), It looks like you might be trying to receive UDP packets but using TCP protocol on the client side. (Or i might just be misunderstanding some of the text of your screenshot.)

Theres no need to 'listen' for a connection when using UDP. UDP packets don't have a connect/disconnect protocol. Nor do they guarantee that packets are received in the same order they're sent.

try using something along these lines in your C# client and see if you get data.

var udpClient = new System.Net.Sockets.UdpClient(9998);
Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜