/// <summary> /// 设置客户端socket的参数 /// </summary> /// <param name="netParam"></param> private void SetParam(NetParam netParam) { IPAddress IP = IPAddress.Parse(netParam.IpAddress); ipEP = new IPEndPoint(IP, netParam.Port); clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, netParam.Protocol); }
private void ServerParam(NetParam netParam) { IPAddress IP = IPAddress.Parse(netParam.IpAddress); IPEndPoint ipEp = new IPEndPoint(IP, netParam.Port); serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, netParam.Protocol); serverSocket.Bind(ipEp); serverSocket.Listen(100); serverSocket.BeginAccept(AcceptCallBack, serverSocket); }
//private List<Socket> ServerSockets = new List<Socket>(); public Server(NetParam netParam) { this.netParam = netParam; }
public Client(NetParam netParam) { this.netParam = netParam; }