Ejemplo n.º 1
0
 public void Dispose()
 {
     try
     {
         clientSocket.Shutdown(SocketShutdown.Both);
     }
     catch
     {
     }
     try
     {
         try
         {
             mySocketEventArgs_0.Completed -= method_1;
             mySocketEventArgs_0.SetBuffer(null, 0, 0);
             mySocketEventArgs_0.Dispose();
         }
         catch
         {
             if (mySocketEventArgs_0 != null)
             {
                 mySocketEventArgs_0.Dispose();
             }
         }
     }
     catch
     {
     }
     try
     {
         clientSocket.Close();
         list_0 = null;
         arc4_0 = (arc4_1 = null);
     }
     catch
     {
     }
     try
     {
         clientSocket.Dispose();
     }
     catch
     {
     }
 }
Ejemplo n.º 2
0
 public MyTcp(string ip, int port, bool isservice = false, string daili = "", ProxyTypes pt = ProxyTypes.None)
 {
     try
     {
         bool_0        = isservice;
         proxySocket_0 = new ProxySocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
         if (daili.Trim().Length > 0)
         {
             string[] array = daili.Split('|');
             if (pt == ProxyTypes.Https)
             {
                 array = daili.Split(':');
             }
             proxySocket_0.ProxyEndPoint = new IPEndPoint(IPAddress.Parse(array[0]), Convert.ToInt32(array[1]));
             if (array.Length > 2)
             {
                 proxySocket_0.ProxyUser = array[2];
                 proxySocket_0.ProxyPass = array[3];
             }
         }
         proxySocket_0.ProxyType = pt;
         arc4_0 = null;
         arc4_1 = null;
         IPAddress address = IPAddress.Parse(ip);
         ipendPoint_0      = new IPEndPoint(address, port);
         timer_3           = new System.Timers.Timer(20.0);
         timer_3.Elapsed  += timer_3_Elapsed;
         timer_3.AutoReset = true;
         timer_0           = new System.Timers.Timer(20.0);
         timer_0.Elapsed  += timer_0_Elapsed;
         timer_0.AutoReset = true;
         timer_1           = new System.Timers.Timer(15000.0);
         timer_1.Elapsed  += timer_1_Elapsed;
         timer_1.AutoReset = true;
         timer_2           = new System.Timers.Timer(63000.0);
         timer_2.Elapsed  += timer_2_Elapsed;
         timer_2.AutoReset = true;
         concurrentQueue_0 = new ConcurrentQueue <byte[]>();
     }
     catch (Exception ex)
     {
         throw new Exception("ctcp:" + ex.Message);
     }
 }
Ejemplo n.º 3
0
 public OldTcp(string ip, int port, string daili = "", ProxyTypes pt = ProxyTypes.None, string localip = "")
 {
     try
     {
         client        = new TcpClient();
         proxySocket_0 = new ProxySocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
         proxySocket_0.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, new LingerOption(true, 0));
         IPAddress address;
         if (!string.IsNullOrWhiteSpace(localip) && IPAddress.TryParse(localip, out address))
         {
             IPEndPoint localEP = new IPEndPoint(address, 0);
             proxySocket_0.Bind(localEP);
         }
         if (daili.Trim().Length > 0)
         {
             string[] array = daili.Split('|');
             if (pt == ProxyTypes.Https)
             {
                 array = daili.Split(':');
             }
             proxySocket_0.ProxyEndPoint = new IPEndPoint(IPAddress.Parse(array[0]), Convert.ToInt32(array[1]));
             if (array.Length > 2)
             {
                 proxySocket_0.ProxyUser = array[2];
                 proxySocket_0.ProxyPass = array[3];
             }
         }
         proxySocket_0.ProxyType = pt;
         client.ReceiveTimeout   = 3000;
         arc4_0 = null;
         arc4_1 = null;
         IPAddress address2 = IPAddress.Parse(ip);
         ipendPoint_0 = new IPEndPoint(address2, port);
     }
     catch (Exception ex)
     {
         throw new Exception("ctcp:" + ex.Message);
     }
 }
Ejemplo n.º 4
0
 protected virtual void Dispose(bool disposing)
 {
     if (!bool_1)
     {
         if (disposing)
         {
             try
             {
                 timer_0.Enabled = false;
                 timer_0.Stop();
                 timer_0.Dispose();
             }
             catch
             {
             }
             try
             {
                 timer_3.Enabled = false;
                 timer_3.Stop();
                 timer_3.Dispose();
             }
             catch
             {
             }
             try
             {
                 timer_1.Enabled = false;
                 timer_1.Stop();
                 timer_1.Dispose();
             }
             catch
             {
             }
             try
             {
                 timer_2.Enabled = false;
                 timer_2.Stop();
                 timer_2.Dispose();
             }
             catch
             {
             }
             try
             {
                 tcpClient_0.GetStream().Close();
             }
             catch
             {
             }
             try
             {
                 proxySocket_0.Close();
                 proxySocket_0.Dispose();
             }
             catch
             {
             }
             try
             {
                 tcpClient_0.Close();
             }
             catch
             {
             }
             arc4_0 = (arc4_1 = null);
         }
         bool_1 = true;
     }
 }