udp 发送一个广播后接收不到数据
czcb 2010-12-09 03:45:50 程序首先发送一个字符串到广播地址 255.255.255.255
然后开始接收返回的数据
UdpClient myUdpClient = new UdpClient();
try
{
IPEndPoint iep = new IPEndPoint(IPAddress.Broadcast, 10000);
myUdpClient.EnableBroadcast = true;
myUdpClient.Send(senddata, senddata.Length, iep);
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
Byte[] receiveBytes =myUdpClient.Receive(ref RemoteIpEndPoint);
string returnData = Encoding.ASCII.GetString(receiveBytes);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "发送失败");
}
现在receiveBytes 返回是null
请指点一下 原来么用过udp