コード例 #1
0
        /// <summary>
        /// Ends session, closes socket.
        /// </summary>
        private void EndSession()
        {
            if (m_pSocket != null)
            {
                m_pSocket.Shutdown(SocketShutdown.Both);
                m_pSocket.Close();
                m_pSocket = null;
            }

            m_pServer.RemoveSession(this);

            // Write logs to log file, if needed
            if (m_pServer.LogCommands)
            {
                m_pLogWriter.AddEntry("//----- Sys: 'Session:'" + this.SessionID + " removed " + DateTime.Now);

                m_pLogWriter.Flush();
            }
        }