private void closeTerminal() { m_ServerTerminal.MessageRecived -= new MessageRecivedDelegate(m_Terminal_MessageRecived); m_ServerTerminal.ClientConnect -= new ConnectDelegate(m_Terminal_ClientConnected); m_ServerTerminal.ClientDisconnect -= new DisconnectDelegate(m_Terminal_ClientDisConnected); m_ServerTerminal.Close(); }
private void closeTerminal() { m_serverTerminal.MessageRecived -= new TCPTerminal_MessageRecivedDel(m_Terminal_MessageRecived); m_serverTerminal.ClientConnect -= new TCPTerminal_ConnectDel(m_Terminal_ClientConnected); m_serverTerminal.ClientDisconnect -= new TCPTerminal_DisconnectDel(m_Terminal_ClientDisConnected); m_serverTerminal.Close(); }
///--------------------------------------------------------------------------------- /// Client ///--------------------------------------------------------------------------------- public void closeClient(Socket clientSock) { if (!myGlobals.ClientServer.ContainsKey(clientSock)) { return; } Socket serverSock = null; if (myGlobals.ClientServer.ContainsKey(clientSock)) { serverSock = myGlobals.ClientServer[clientSock]; } if (toClient.m_clients.ContainsKey(clientSock)) { toClient.Close(clientSock); } if (myGlobals.ClientServer.ContainsKey(clientSock)) { myGlobals.ClientServer.Remove(clientSock); } if (serverSock != null) { if (myGlobals.ServerClient.ContainsValue(serverSock)) { myGlobals.ServerClient.Remove(serverSock); } } string operatorName = myGlobals.operatorData.getOperatorName(clientSock); if (operatorName != null) { if (myGlobals.operatorData.operators.ContainsKey(operatorName)) { myGlobals.operatorData.operators.Remove(operatorName); } } if (clientTimers.ContainsKey(clientSock)) { clientTimers[clientSock].stop(); clientTimers.Remove(clientSock); } long sock = clientSock.Handle.ToInt64(); PublishMessage(logBox1, string.Format("Client {0}(socket:{1}) has been disconnected!", clientSock.LocalEndPoint, sock)); }