/// <summary> /// 异步Socket TCP服务器 /// </summary> /// <param name="localIPAddress">监听的IP地址</param> /// <param name="listenPort">监听的端口</param> /// <param name="maxClient">最大客户端数量</param> public AsyncIOCPServer(IPAddress localIPAddress, int listenPort, int maxClient) { instance = this; this.Address = localIPAddress; this.Port = listenPort; _maxClient = maxClient; _serverSock = new Socket(localIPAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp); _userTokenPool = new AsyncUserTokenPool(_maxClient); _maxAcceptedClients = new Semaphore(_maxClient, _maxClient); instance.Start(); }