using System;
using System.Net; //IPAddress
using System.Net.Sockets;
using System.Text;
/*
1、C#的Socket类是对操作系统底层socket API的封装。
一个Socket对象,包含了本地Ip、本地端口、远程ip、远程端口、协议相关配置等信息,这些信息构成了最基本的沟通元素。
ip和端口构成一个网络的终端,在C#中有一个类型专门用来描述两者,这个类是IEndPoint,
定义一个IEndPoint:
IPEndPoint endpoint=new IPEndPoint(ipaddress, port);
2、建立 Socket
//SocketType.Dgram : 数据报、电报 、数据包,单个。
//ProtocolType.Udp : 协议类型 UDP的协议
ReceiveSock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
3、IP 地址和端口
IPAddress ipAddress = new IPAddress(new byte[] { 192,168,0,70 });
//ip + port
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress , 7788);
4、 //4: 绑定IP地址、端口等信息到socket上,用函数Bind();
udpServer.Bind(ipEndPoint);
5、 接受数据
*/
namespace UDP服务器端
{
public