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));
}