FTP timeout / reconnection

prokli

Active Member
Licensed User
Longtime User
Hi everybody!

I realized some small problems when using the wrong address of a remotely located FTP server.
My program works fine as long as I use the correct IP Address (e.g. 192.168.150.22)
When I falsify the IP's last byte address (for example 192.168.150.20), the Success state in FTP.UploadCompleted (ServerPath As String, Success As Boolean) returns "False" after about 2 seconds. This is what I expect!

Now, if falsify the IP's second byte (for example 192.168.100.22), I never get an event (see FTP.UploadCompleted(...) and I have to wait a long time (several minutes) till I can reconnect to FTP using the correct address.

Is there any FTP timeout which I can configure???

Thx
:sign0085:
 

prokli

Active Member
Licensed User
Longtime User
Erel,

that is what I am doing!

Since there is no explicit connection event for FTP object (like for sockets) I do the following steps:

Request a list of documents from FTP server (just to see if there is a FTP server)
- FTP_Client.List("/")
Start a timer
- StartTimer.Interval = 10000

In "FTP_Client_ListCompleted()" I check "Sucess" byte
If I get "Success = True" or "Success = False" everything is fine!. But if I am going to use a wrong IP address (one of the upper bytes) I never get a ListCompleted event. In this circumstance the timer (StartTimer) expires after about 10 sec and calls "FTP_Client.CloseNow" .

Nevertheless, I still have to wait up to 10 Minutes till I can access the FTP object again. If I do this to early I always get no "FTP_Client_ListCompleted" event, not even when I use the correct IP address!

My little workaround:
I compare the three upper address bytes of the FTP server with my local network. If this fails, I prevent connection to the FTP object at all.

Thx
 
Upvote 0

prokli

Active Member
Licensed User
Longtime User
Erel,

Sorry, it still doesn't work! :eek:

I upgraded net library to version 1.21 (07.06.2012).
The complete code of my FTP client is part of an android service:

Sub Process_Globals
Dim FTP_Client As FTP
…..
....
End Sub


Sub Service_Start (StartingIntent As Intent)


FTP_Client.Initialize("FTP_Client", oFTP_IP, oFTP_Port, oFTP_User, oFTP_Passw)
..........
.........

End Sub


Sub Service_Destroy
FTP_Client.CloseNow
Log("FTP Service killed")
End Sub


If timer detects a failed connection to FTP server it calls

StopService("")

So I assume that I have done what you have recommended to me:
- Upgrading net library
- re-Dim and reinitialize FTP_Client

Thx
 
Upvote 0
Top