UDP 通讯中 接收byte的时候停止了!!
void ReceiveMessage()
{
//UdpClientB = new UdpClient(portclient); //B开启的端口号
//remotePoint = new IPEndPoint(IPAddress.Any, 0);
int recv;
byte[] bytes = new byte[1024];
IPEndPoint ipt = new IPEndPoint(IPAddress.Any, 13000);
Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
server.Bind(ipt);
while (true)
{
try
{
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
EndPoint Remote = (EndPoint)(sender);
recv = server.ReceiveFrom(bytes, ref Remote);
MessagePP com = (MessagePP)DeserializeObject(bytes);
if (com.command == 0)
{
ReceivedACK = true;
}
else
{
//收的都是图片了
MessageBox.Show("B已经收到了A发来的图片消息了");
}
}
catch
{
}
}
}
单步调试,到了红色的那行代码处,没有继续往下运行了.....求助...正在弄UDP打洞,这个为Client,监听着自己这边的一个端口,然后要得到其他Client发过来的数据