I am trying to connect to a remote host using via a gatekeeper. The gatekeeper requires authorization (username/password), so I am assuming this is a SOCKS5 proxy.
Here is the snippet from my code :
try
{
ExFTPConnection ftpConn = new ExFTPConnection();
ftpConn.ServerAddress = "10.10.10.10";
ftpConn.ServerPort = 21;
ftpConn.UserName = "userName";
ftpConn.Password = "passWord";
Socks5Context socks = new Socks5Context("gatekeeper.myhost.com", 21);
socks.AuthMethods.Add(new Socks5UserNamePasswordAuthMethod("gwUser", " gwPassword"));
ftpConn.SocksProxySettings = socks;
ftpConn.Connect();
}
catch(Exception e )
{
Console.WriteLine ( e.message );
}
The problem is that the Connect throws an exception. And I get a message stating "Version 5 SOCKS rejected."
Does this mean that the proxy type is not SOCKS5 ? How do I authenticate if the proxy is not of SOCKS5 type ?
Here is the stack trace :
at ec.b(BaseSocket A_0)
at ec.a(a A_0, BaseSocket A_1, IPAddress A_2, Int32 A_3)
at f6.a(BaseSocket A_0, IPAddress A_1, Int32 A_2)
at au.a(BaseSocket A_0, IPAddress A_1, Int32 A_2)
at EnterpriseDT.Net.Ftp.FTPControlSocket.a(BaseSocket A_0, IPAddress A_1, Int32 A_2, Int32 A_3, Encoding A_4)
at au.a(BaseSocket A_0, Boolean A_1, SocksContext A_2, IPAddress A_3, Int32 A_4, Int32 A_5, Encoding A_6)
at au..ctor(Boolean isTrial, SocksContext socksContext, IPAddress remoteHost, Int32 controlPort, Int32 timeout, Encoding encoding)
at EnterpriseDT.Net.Ftp.ExFTPClient.Connect()
at EnterpriseDT.Net.Ftp.FTPConnection.Connect()
at EnterpriseDT.Net.Ftp.ExFTPConnection.Connect()
at EDTFTP.Program.Main(String[] args) in C:\Schwab\SQT\Projects\EDTFTP\Program.cs:line 33