public void Disconnect()
 {
     if (m_Closed)
     {
         return;
     }
     m_Closed = true;
     try {
         using (var socket = m_Socket.GetSocket()) {
             socket.Shutdown(SocketShutdown.Both);
             socket.Close();
         }
     } catch (System.Exception e) {
         logger.error("Connection Disconnect is error : " + e.ToString());
     } finally {
         try {
             if (m_Host != null)
             {
                 m_Host.OnDisconnect(this);
             }
             OnDisconnect();
         } catch (System.Exception e) {
             logger.error("Connection OnDisconnect is error : " + e.ToString());
         }
     }
 }
Exemple #2
0
 public void Disconnect()
 {
     if (m_Closed)
     {
         return;
     }
     m_Closed = true;
     try {
         using (var socket = m_Socket.GetSocket()) {
             socket.Shutdown(SocketShutdown.Both);
             socket.Close();
         }
     } finally {
         if (m_Host != null)
         {
             m_Host.OnDisconnect(this);
         }
         OnDisconnect();
     }
 }