Exemplo n.º 1
0
        /// <summary>
        /// Gets called when the socket for this connection was closed, for any reason
        /// </summary>
        /// <param name="msg"> a message explaining the socket closure, if any</param>
        protected override void OnSocketKilled(string msg)
        {
#if !SILVERLIGHT
            m_UDPKeepAlive.Elapsed -= new System.Timers.ElapsedEventHandler(OnUDPKeepAlive);
            m_UDPKeepAlive.Stop();
            m_UDPKeepAlive.Dispose();

            try
            {
                if (m_UDPListener != null)
                {
                    m_UDPListener.StopListening();
                    if (m_UDPListener is UDPListenerSimplex)
                    {
                        ((UDPListenerSimplex)m_UDPListener).StopNetworkingPump();
                    }
                    m_UDPListener = null;
                }
            }
            catch { }
#endif

            base.OnSocketKilled(msg);
            m_ConnectionInProgress = false;
            m_ConnectionWasKilled  = true;
        }