Пример #1
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        public void Dispose()
        {
            if (m_IsDisposed)
            {
                return;
            }
            if (m_IsRunning)
            {
                try
                {
                    Stop();
                }
                catch
                {
                }
            }
            m_IsDisposed = true;

            // We must call disposed event before we release events.
            try
            {
                OnDisposed();
            }
            catch
            {
                // We never should get exception here, user should handle it, just skip it.
            }

            m_pSessions = null;

            // Release all events.
            this.Started  = null;
            this.Stopped  = null;
            this.Disposed = null;
            this.Error    = null;
        }
Пример #2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public TCP_Server()
 {
     m_pConnectionAcceptors = new List <TCP_Server <T> .TCP_Acceptor>();
     m_pListeningPoints     = new List <TCP_Server <T> .ListeningPoint>();
     m_pSessions            = new TCP_SessionCollection <TCP_ServerSession>();
 }