Connect to FTP server by Proxy Server - WeOnlyDo Discussion board

Connect to FTP server by Proxy Server (General questions)

by zhou, Friday, August 11, 2006, 09:34 (6679 days ago)

I want to connect to a FTP server by a FTP proxy using following code.
{
m_Ftp.SetHostname( FTP.Server.com );
m_Ftp.SetLogin( username );
m_Ftp.SetPassword( Password );
m_Ftp.SetProtocol(0); //0 FTP protocol
m_Ftp.SetPort(21);

m_Ftp.SetPassive(true);

m_Ftp.SetProxyType(102); //USER RemoteID@RemoteHost
m_Ftp.SetProxyHostname( FTP.proxy.Server.com );
m_Ftp.SetProxyPort(21);
m_Ftp.SetProxyLogin ( username ); //Same user and password as connect to the FTP server.
m_Ftp.SetProxyPassword( Password );
}

The FtpDLX can not connect to the server, giving a response as CONNECTED ERROR: Invalid username or password reported by server. But I use same setting in the FileZilla, FileZilla do can connnect to the server. Please tell me if there something wrong with the source code. And please tell me is there any method to get the raw reponse message from the FTP server?

Re: Connect to FTP server by Proxy Server

by wodAlan, Friday, August 11, 2006, 10:03 (6679 days ago) @ zhou

Hi zhou,

Ok, this is my test code:

[code]
Ftp1.Blocking = True

Ftp1.ProxyType = ProxyWindows
Ftp1.ProxyHostname = 192.168.0.1
Ftp1.ProxyLogin = proxyLogin
Ftp1.ProxyPassword = proxyPassword

Ftp1.HostName = ftp.server.com
Ftp1.Login = username
Ftp1.Password = password

Ftp1.Connect
[/code]

Maybe you should set Blocking Property to True but try code similar like mine and this must work for you too.

Hope I helped.

Regards,
Alan

Re: Connect to FTP server by Proxy Server

by wodSupport, Friday, August 11, 2006, 10:52 (6679 days ago) @ wodAlan

Zhou,

quick workaround would be to completely ignore the proxy settings. Rather do something like this:

Ftp1.Hostname = your.proxy.server
Ftp1.Login = login
Ftp1.Password = your_secret_pass@your.real.ftp.server
Ftp1.Connect..

As you can see, you would connect to proxy as it would be your actual FTP server, and you would use username with real FTP address in it - proxy FTP would usually just redirect to real FTP. Can you try that?

Kreso