Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.9k views
in .NET FTP by (160 points)
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

2 Answers

0 votes
by (51.6k points)
I noticed that the port of the gatekeeper proxy is set to 21. Are you sure that's correct? That port is usually used for FTP, not SOCKS, though I guess it does make sense in a way to use it in this case.

If you're sure it's correct then please try using SOCKS4 as well.

Do you know what type of proxy it is?

- Hans (EDT)
0 votes
by (160 points)
It turned out to be a simple FTP proxy and of non-socks type. Hence the port 21 too.
I found a reference to connecting via such a proxy in your developer guide for the free version of the edtlibrary and it is now working.
Thanks!

I noticed that the port of the gatekeeper proxy is set to 21. Are you sure that's correct? That port is usually used for FTP, not SOCKS, though I guess it does make sense in a way to use it in this case.

If you're sure it's correct then please try using SOCKS4 as well.

Do you know what type of proxy it is?

- Hans (EDT)

Categories

...