发送广播
/// <summary>
/// 用于UDP发送的网络服务类
/// </summary>
private UdpClient udpcSend;
private void BtnSend_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (string.IsNullOrWhiteSpace(txtSendMssg.Text))
{
MessageBox.Show("请先输入待发送内容");
return;
}
// 实名发送
IPEndPoint localIpep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8449); // 本机IP,指定的端口号
udpcSend = new UdpClient(new IPEndPoint(IPAddress.Any, 0));//定义本地ip和端口号
Thread thrSend = new Thread(SendMessage);
thrSend.Start(txtSendMssg.Text);
}
/// <summary>
/// 发送消息
/// </summary>
private void