Example #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.
            Started  = null;
            Stopped  = null;
            Disposed = null;
            Error    = null;
        }
 /// <summary>
 /// Default constructor.
 /// </summary>
 public TCP_Server()
 {
     m_pListeningPoints = new List <ListeningPoint>();
     m_pSessions        = new TCP_SessionCollection <T>();
 }