UDP协议接收没反应,求救!~
我想接收远端服务器某IP,某端口的一些信息,怎么做呀?我按照MSDN上写的做了,为啥接收的时候一直是读取状态,没有反应呀。下面是我的代码,求救!!~~TextBox2.Text = "222.136.71.137";
TextBox3.Text = "27017";
TextBox4.Text = "ping";
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Parse(TextBox2.Text),int.Parse(TextBox3.Text));
//创建连接实例
UdpClient udpClient = new UdpClient();
//连接服务器
udpClient.Connect(RemoteIpEndPoint);
//创建发送数据实例
Byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes(TextBox4.Text);
//发送数据
udpClient.Send(sendBytes, sendBytes.Length);
//创建返回数据实例
Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
string returnData = System.Text.Encoding.ASCII.GetString(receiveBytes);
// Uses the IPEndPoint object to determine which of these two hosts responded.
Label2.Text = returnData.ToString()+"<br>This message was sent from "+RemoteIpEndPoint.Address.ToString() + " on their port number " +
RemoteIpEndPoint.Port.ToString();
udpClient.Close(); --------------------编程问答-------------------- 顶一下,有人没。。。。 --------------------编程问答-------------------- 不会 --------------------编程问答-------------------- ..... --------------------编程问答-------------------- 222.136.71.137 给你发消息了吗 --------------------编程问答-------------------- up
补充:.NET技术 , ASP.NET