Beispiel #1
0
 /// <summary>
 /// 清理
 /// </summary>
 void close()
 {
     if (Tcp_Client != null)
     {
         try
         {
             Program.PrintLog(string.Format("已断开客户端{0}的连接", Tcp_Client.Client.RemoteEndPoint));
             Client_Stream.Close();
             Tcp_Client.Close();
             Tcp_Client = null;
         }
         catch (NullReferenceException) {
         }
     }
     if (Tcp_Proxy != null)
     {
         try
         {
             Program.PrintLog(string.Format("已断开代理端{0}的连接", Tcp_Proxy.Client.RemoteEndPoint));
             Proxy_Stream.Close();
             Tcp_Proxy.Close();
             Tcp_Proxy = null;
         }
         catch (NullReferenceException) {
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// TCP清理
 /// </summary>
 private void close()
 {
     try
     {
         if (TCP_Client != null)
         {
             DataHandle.WriteLog(string.Format("已断开客户端{0}的连接", TCP_Client.Client.RemoteEndPoint));
             Client_Stream.Close();
             TCP_Client.Close();
             TCP_Client = null;
         }
         if (TCP_Proxy != null)
         {
             DataHandle.WriteLog(string.Format("已断开代理端{0}的连接", TCP_Proxy.Client.RemoteEndPoint));
             Proxy_Stream.Close();
             TCP_Proxy.Close();
             TCP_Proxy = null;
         }
     }
     catch (Exception)
     {
     }
 }