//客户端连接掉线 private void close_clientSocket(SocketAsyncEventArgs e) { AsyncUserToken token = e.UserToken as AsyncUserToken; //close the socket associated with the client try { token.Socket.Shutdown(SocketShutdown.Send); token.Buffer.Clear(); //删除socket对应的robot m_robotSystem.remove_robot(token.Socket); //TODO:删除MapManager对应areaList里的robotId; } catch (Exception) { Log.INFO("client process has already closed"); } token.Socket.Close(); Interlocked.Decrement(ref m_numConnectedSocket); m_receiveEventArgsPool.push(e); m_numAcceptedClientsMax.Release(); Log.INFO("A client has been disconnected from the server. There are {0} clients connected to the server", m_numConnectedSocket); }