资源简介
利用C#语言实现UDP广播通信,客户端利用委托向控件传递信息,可以利用网络调试助手在其他一台电脑上进行模拟测试。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace _22_UDP之广播服务器
{
public partial class Form1 : Form
{
private Socket sockets;
private IPEndPoint point;
private byte[] bt;
public Form1()
{
InitializeComponent();
Net();
}
private void Net()
{
sockets = new Socket(AddressFamily.InterNetworkSocketType.DgramProtocolType.Udp);
point = new IPEndPoint(IPAddress.Broadcast8090);
string hostname = Dns.GetHostName();
bt = Encoding.UTF8.GetBytes(hostname);
sockets.SetSocketOption(SocketOptionLevel.SocketSocketOptionName.Broadcast1);
// Thread c_thread = new Thread(message);
// c_thread.IsBackground = true;
// c_thread.Start();
}
/*
private void message()
{
while (true)
{
sockets.SendTo(btpoint);
Thread.Sleep(2000);
}
}
*/
private void button1_Click(object sender EventArgs e)
{
sockets.SendTo(bt point);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3828 2017-09-02 22:30 22-UDP之广播服务器\22-UDP之广播服务器\22-UDP之广播服务器.csproj
文件 187 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\App.config
文件 8704 2018-08-01 20:38 22-UDP之广播服务器\22-UDP之广播服务器\bin\Debug\22-UDP之广播服务器.exe
文件 187 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\bin\Debug\22-UDP之广播服务器.exe.config
文件 26112 2018-08-01 20:38 22-UDP之广播服务器\22-UDP之广播服务器\bin\Debug\22-UDP之广播服务器.pdb
文件 22984 2018-08-01 20:38 22-UDP之广播服务器\22-UDP之广播服务器\bin\Debug\22-UDP之广播服务器.vshost.exe
文件 187 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\bin\Debug\22-UDP之广播服务器.vshost.exe.config
文件 490 2015-11-13 10:24 22-UDP之广播服务器\22-UDP之广播服务器\bin\Debug\22-UDP之广播服务器.vshost.exe.manifest
文件 1474 2018-08-01 20:38 22-UDP之广播服务器\22-UDP之广播服务器\Form1.cs
文件 2066 2018-08-01 20:34 22-UDP之广播服务器\22-UDP之广播服务器\Form1.Designer.cs
文件 5817 2018-08-01 20:34 22-UDP之广播服务器\22-UDP之广播服务器\Form1.resx
文件 2414 2018-08-01 20:38 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\22-UDP之广播服务器.csproj.FileListAbsolute.txt
文件 975 2018-08-01 20:34 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\22-UDP之广播服务器.csproj.GenerateResource.Cache
文件 8704 2018-08-01 20:38 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\22-UDP之广播服务器.exe
文件 26112 2018-08-01 20:38 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\22-UDP之广播服务器.pdb
文件 1278 2017-09-02 23:24 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7133 2017-11-06 21:13 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 180 2018-08-01 20:34 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\_22_UDP之广播服务器.Form1.resources
文件 180 2018-08-01 20:34 22-UDP之广播服务器\22-UDP之广播服务器\obj\Debug\_22_UDP之广播服务器.Properties.Resources.resources
文件 537 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\Program.cs
文件 1386 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\Properties\AssemblyInfo.cs
文件 2902 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\Properties\Resources.Designer.cs
文件 5612 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\Properties\Resources.resx
文件 1112 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\Properties\Settings.Designer.cs
文件 249 2017-09-02 22:16 22-UDP之广播服务器\22-UDP之广播服务器\Properties\Settings.settings
文件 962 2017-09-02 22:17 22-UDP之广播服务器\22-UDP之广播服务器.sln
..A..H. 8192 2018-08-01 20:23 22-UDP之广播服务器\22-UDP之广播服务器.suo
............此处省略53个文件信息
相关资源
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论