sbh
Hello,
we use SmartFTP FTP Library with an application developed in Delphi 6. Our customers have different network environments e.g. with or without proxy, some must use passive FTP, some not, etc. We handle events by using an EventSink generated with Delphi Event Sink Generator (by Binh Ly). Here is some log to see what FTP server is used:
[20060425 12:49:59] Resolving host name "x.x.x.x"
[20060425 12:49:59] Connecting to x.x.x.x Port: 21
[20060425 12:49:59] Connected to x.x.x.x.
[20060425 12:49:59] 220 (vsFTPd 2.0.2)
[20060425 12:49:59] USER sbh-ftp
[20060425 12:49:59] 331 Please specify the password.
[20060425 12:49:59] PASS (hidden)
[20060425 12:49:59] 230 Login successful.
[20060425 12:49:59] SYST
[20060425 12:49:59] 215 UNIX Type: L8
[20060425 12:49:59] FEAT
[20060425 12:49:59] 211-Features:
[20060425 12:49:59] EPRT
[20060425 12:49:59] EPSV
[20060425 12:49:59] MDTM
[20060425 12:49:59] PASV
[20060425 12:49:59] REST STREAM
[20060425 12:49:59] SIZE
[20060425 12:49:59] TVFS
[20060425 12:49:59] 211 End
The Problem that I want to describe comes up with customers who use a FTP proxy (ftpFTPProxyTypeOpen) and must use passive FTP. Our application is automatically (without user interaction) doing the following:
We have analysed the problem with a little test application which is more interactive e.g. you can connect to and disconnect from the FTP server by button click. We have logged the OnStatus, OnDisconnect and OnSocketDisconnect events and there is a difference between the two cases with proxy/passive FTP and without proxy/no need to use passive FTP:
1. No proxy and not passive FTP
Disconnect Start
OnStatus: QUIT
OnStatus: 221 Goodbye.
OnStatus: Client closed the connection.
OnSocketDisconnected: *** Socket Disconnected ***
OnDisconnected: *** Disconnected ***
Disconnect End (ReturnCode: Error 0 (Success))
2. With FTP proxy and passive FTP
Disconnect Start
OnStatus: QUIT
OnStatus: 221 Goodbye.
OnDisconnected: *** Disconnected ***
Disconnect End (ReturnCode: Error 23 (ConnectionClosed))
OnStatus: Server closed connection
OnSocketDisconnected: *** Socket Disconnected ***
In the first case also our non interactive application is working fine. In the second case it is freezing in the Disconnect of the EventSink and we think it has to do with the Events after the Disconnect from the FTP server. Our application also logs the OnStatus event and until it freezes we can only see the two lines
QUIT
221 Goodbye.
The OnStatus event with "Server closed connection" is not handled until the Disconnect of the EventSink.
We found a dirty workaround to avoid the freezing of our application by placing a waitloop with ProcessMessages between the Disconnect from the FTP server and the Disconnect of the EventSink. But we are not happy about this.
Maybe you have a better idea to handle this situation.
Best regards
Robert Meier
SBH
we use SmartFTP FTP Library with an application developed in Delphi 6. Our customers have different network environments e.g. with or without proxy, some must use passive FTP, some not, etc. We handle events by using an EventSink generated with Delphi Event Sink Generator (by Binh Ly). Here is some log to see what FTP server is used:
[20060425 12:49:59] Resolving host name "x.x.x.x"
[20060425 12:49:59] Connecting to x.x.x.x Port: 21
[20060425 12:49:59] Connected to x.x.x.x.
[20060425 12:49:59] 220 (vsFTPd 2.0.2)
[20060425 12:49:59] USER sbh-ftp
[20060425 12:49:59] 331 Please specify the password.
[20060425 12:49:59] PASS (hidden)
[20060425 12:49:59] 230 Login successful.
[20060425 12:49:59] SYST
[20060425 12:49:59] 215 UNIX Type: L8
[20060425 12:49:59] FEAT
[20060425 12:49:59] 211-Features:
[20060425 12:49:59] EPRT
[20060425 12:49:59] EPSV
[20060425 12:49:59] MDTM
[20060425 12:49:59] PASV
[20060425 12:49:59] REST STREAM
[20060425 12:49:59] SIZE
[20060425 12:49:59] TVFS
[20060425 12:49:59] 211 End
The Problem that I want to describe comes up with customers who use a FTP proxy (ftpFTPProxyTypeOpen) and must use passive FTP. Our application is automatically (without user interaction) doing the following:
- Create IFTPConnection (FTPConnectionSTA)
- Create EventSink
- Connect EventSink with IFTPConnection
- Set properties of IFTPConnection
- Set EventProcs to EventSink
- Connect with FTP server
- List, DownloadFile, DeleteFile
- Disconnect from FTP server
- Disconnect EventSink
- Destroy EventSink
- Destroy IFTPConnection
We have analysed the problem with a little test application which is more interactive e.g. you can connect to and disconnect from the FTP server by button click. We have logged the OnStatus, OnDisconnect and OnSocketDisconnect events and there is a difference between the two cases with proxy/passive FTP and without proxy/no need to use passive FTP:
1. No proxy and not passive FTP
Disconnect Start
OnStatus: QUIT
OnStatus: 221 Goodbye.
OnStatus: Client closed the connection.
OnSocketDisconnected: *** Socket Disconnected ***
OnDisconnected: *** Disconnected ***
Disconnect End (ReturnCode: Error 0 (Success))
2. With FTP proxy and passive FTP
Disconnect Start
OnStatus: QUIT
OnStatus: 221 Goodbye.
OnDisconnected: *** Disconnected ***
Disconnect End (ReturnCode: Error 23 (ConnectionClosed))
OnStatus: Server closed connection
OnSocketDisconnected: *** Socket Disconnected ***
In the first case also our non interactive application is working fine. In the second case it is freezing in the Disconnect of the EventSink and we think it has to do with the Events after the Disconnect from the FTP server. Our application also logs the OnStatus event and until it freezes we can only see the two lines
QUIT
221 Goodbye.
The OnStatus event with "Server closed connection" is not handled until the Disconnect of the EventSink.
We found a dirty workaround to avoid the freezing of our application by placing a waitloop with ProcessMessages between the Disconnect from the FTP server and the Disconnect of the EventSink. But we are not happy about this.
Maybe you have a better idea to handle this situation.
Best regards
Robert Meier
SBH