We help IT Professionals succeed at work.
Get Started

Connect to FTP via Proxy (Error by Connect > GetResponse([220])) ( Indy FTP Client Delphi ) "Sample code!?" HELP!!

alex0101
alex0101 asked
on
4,973 Views
Last Modified: 2010-10-05
hi,

I'm trying to connect to a FTP Server via Proxy Server,
i receive a exception "Connection Closed Gracefully."

Have somebody a sample sourcecode to connect to FTP via a Proxy Server with Indy FTP Module ?
Is my code wrong?

I have trying to connect with TotalCommander, and its works. Why it dosnt work with my code?
(In Total commander i have choosed "HttpProxyWithFtp")
In my code, i have alredy trying another Proxy types.. but it donst help...

I'm trying following:

// Using Indy V10

idFTP1.AutoLogin := True;
idFTP1.Username := "FTPUserName";
idFTP1.Password  := "FTPUserPasword";
idFTP1.Host         := "Target FTP Host IP Address"; // 70.***.***.***

idFTP1.ProxySettings.ProxyType := fpcmOpen; // or fpcmHttpProxyWithFtp; // or another one...?
idFTP1.ProxySettings.UserName := ""; // no Proxy - UserName and password requed
idFTP1.ProxySettings.Password  := ""; // no Proxy - UserName and password requed
idFTP1.ProxySettings.Host          := "ProxyServerIPAddress"; //192.168.***.***
idFTP1.ProxySettings.Port          := 4480; // Proxy Port

idFTP1.Passive := TRUE; // or FALSE?
idFTP1.ConnectTimeOut := 7000;
idFTP1.TransferTimeOut := 7000;

try
  idFTP1.Connect; // => Exception by GetResponse([220])=>CheckConnected function.
  ShowMessage('Connect is OK!');
except
  on E : Exception do
  begin
     ShowMessage(E.Message);
  end;
end;

Have i fogot anything?

Here is a LOG OUT from my Funktion + idFTP,idTCPConnection units.

///////////////// LOG OUT (FROM Connect Function) /////////////////
PROXY-TYPE:Open
PROXY-HOST:192.168.***.***
PROXY-USER:
FTP-HOST:70.***.***.***
FTP-USER:FTPUserName
FTP: PASSIVE
FTP-SET-CONNECTTIMEOUT:7000
FTP-SET-TRANSFERTIMEOUT:7000
Connecting to FTP ...
LOG:FTPCONNECTSTART // Calling idFTP1.Connect
LOG:PROXY_L:70.***.***.***:21  // Parameters in the Connect function
LOG:PROXY_F:192.168.***.***:4480 // Parameters in the Connect function
LOG:USING TLC? => NO
LOG:CALL CONNECT... // inherited Connect;
FTP-STATUS:Connecting to 192.168.***.***.  // idFTP1.OnStatus
FTP-STATUS:Connected.                                 // idFTP1.OnStatus
LOG:CALL RESPONSE...  // Calling GetResponse([220])
LOG:CALL GetInternalResponse...  // Calling GetInternalResponse
LOG:CALL CheckConnected...       // CheckConnected  => after 5 Min. => Exception
FTP-STATUS:Disconnected.      // idFTP1.OnStatus
ERROR!:Connection Closed Gracefully.  // Exception !!!!
///////////////////////////////////////////////////////////////////////// END LOG ///////////////////

Why it dosnt work?

Alex
Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 13 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE