问题描述
C#中socket.receivefrom读取数据时被阻塞了,但是wireshark却抓到了包。这可能是什么原因呢?代码很简单,就以下几句:IPEndPointlocalEndPoint=newIPEndPoint(IPAddress.Any,3000);SocketlocalSocket=newSocket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);localSocket.Bind(localEndPoint);byte[]revBuffer=newbyte[1024];EndPointremotePoint=(EndPoint)localEndPoint;localSocket.ReceiveFrom(revBuffer,remotePoint);执行localSocket.ReceiveFrom(revBuffer,remotePoint);时阻塞了,但是wir额shark却抓到了包,可能是什么原因呢?很疑惑。
解决方案
解决方案二:
remotePoint和抓到的包对的上吗?
时间: 2024-10-14 14:49:28