Exemple #1
0
 private void DisconnectSocket()
 {
     if (this.m_socket == null)
     {
         return;
     }
     try
     {
         if (this.m_socket.get_Connected())
         {
             this.m_socket.Shutdown(2);
             this.m_socket.Close();
         }
     }
     catch (Exception ex)
     {
         LogAdapter.Log(LogLevel.Warning, string.Format("DisconnectSocket() failed. error: {0},", ex.get_Message()));
         if (ex is SocketException)
         {
             SocketException ex2 = (SocketException)ex;
             LogAdapter.Log(LogLevel.Warning, string.Format("\t Socket Error Code: {0},", ex2.get_ErrorCode()));
         }
     }
     this.m_socket = null;
 }