DoSocksAuth() public static method

public static DoSocksAuth ( Socks5Client p, string Username, string Password ) : bool
p Socks5Client
Username string
Password string
return bool
示例#1
0
 public bool ConnectWithEp()
 {
     p      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     Client = new Client(p, 65535);
     Client.Sock.Connect(ep);
     //try the greeting.
     //Client.onDataReceived += Client_onDataReceived;
     if (Socks.DoSocksAuth(this, Username, Password))
     {
         if (Socks.SendRequest(Client, enc, Dest, Destport) == SocksError.Granted)
         {
             Client.onDataReceived += Client_onDataReceived;
             return(true);
         }
     }
     return(false);
 }
示例#2
0
 private void onConnected(IAsyncResult res)
 {
     Client = (Client)res.AsyncState;
     try
     {
         Client.Sock.EndConnect(res);
     }
     catch
     {
         this.OnConnected(this, new Socks5ClientArgs(null, SocksError.Failure));
         return;
     }
     if (Socks.DoSocksAuth(this, Username, Password))
     {
         SocksError p = Socks.SendRequest(Client, enc, Dest, Destport);
         Client.onDataReceived += Client_onDataReceived;
         this.OnConnected(this, new Socks5ClientArgs(this, p));
     }
     else
     {
         this.OnConnected(this, new Socks5ClientArgs(this, SocksError.Failure));
     }
 }