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发过来的数据
{
//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发过来的数据
...全文
相关推荐
基于UDP协议的串口通讯DEMO
基于UDP协议的串口通讯DEMO
C++ 客户端通讯库(TCP/UDP/SERIALPORT)
C++Builder 10.0下调试通过。基于后台的网口+串口通信代码(包含简单的同步/异步回调实例)。
Visual C++设计UDP协议通讯示例.doc
Visual C++设计UDP协议通讯示例.doc Visual C++设计UDP协议通讯示例.doc Visual C++设计UDP协议通讯示例.doc Visual C++设计UDP协议通讯示例.doc
python基于socket实现的UDP及TCP通讯功能示例
主要介绍了python基于socket实现的UDP及TCP通讯功能,结合实例形式分析了基于Python socket模块的UDP及TCP通信相关客户端、服务器端实现技巧,需要的朋友可以参考下
串口、TCP、UDP、蓝牙通讯程序
Windows 平台的通讯测试程序,包含串口、TCP、UDP、蓝牙等通讯接口,支持16进制及文本编辑模式;支持自定义命令,条件发送;可以方便的测试设备的通讯。


