Esempio n. 1
0
 public static void DisposeTcpClient(CtkTcpClient client)
 {
     if (client == null)
     {
         return;
     }
     client.Disconnect();
     client.Dispose();
 }
Esempio n. 2
0
 public static bool DisposeTcpClientTry(CtkTcpClient client)
 {
     try
     {
         DisposeTcpClient(client);
         return(true);
     }
     catch (SocketException) { return(false); }
     catch (ObjectDisposedException) { return(false); }
     catch (InvalidOperationException) { return(false); }
     catch (Exception ex)
     {
         //非預期的Exception, 記錄起來
         CtkLog.Warn(ex);
         return(false);
     }
 }