public static DoSocksAuth ( |
||
p | ||
Username | string | |
Password | string | |
return | bool |
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); }
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)); } }