日期:2014-05-18 浏览次数:21112 次
Socket serverSocket = (Socket)ar.AsyncState; Socket clientSocket = serverSocket.EndAccept(ar); state = new StateObject(); state.workSocket = clientSocket; Send("connected"); this.serverSocket.BeginAccept(new AsyncCallback(AcceptCallback), this.serverSocket); clientSocket.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), state);