Working with ftp timeouts

Discuss any general programming issues here
Post Reply
User avatar
JurassicC
Posts: 36
Joined: Fri May 25, 2012 9:48 pm

Working with ftp timeouts

Post by JurassicC »

I want to introduce an error check for an ftp server.

Thinking outloud here

I know the default timeout is 10 seconds and can be lowered but as I'm making upto 148 DownloadFile() connections one after the other I would idealy like to check if the ftpserver is reachable first rather than have to deal with 148 timeouts.

Is getting the server state possible from within hollywood ? Or would I have to use the host operating system :-

Eg:-
Execute(C:\Users\xxxxxxx\Desktop\Test\Ping.BAT)

Where Ping.BAT is

ping ftp.server.ip.com > C:\Users\xxxxxxx\Desktop\Test\PingResults.TXT

So I should have a PingResults.TXT file with some thing similar to this in it:-

Reply from nnn.zzz.xxx.yyy: bytes=32 time=101ms TTL=124
Reply from nnn.zzz.xxx.yyy: bytes=32 time=100ms TTL=124
Reply from nnn.zzz.xxx.yyy: bytes=32 time=120ms TTL=124
Reply from nnn.zzz.xxx.yyy: bytes=32 time=120ms TTL=124

could i then do, as you only get a TTL if the server is up , something like below ? (I know the ping time might vary and move the start position of the TTL in the string but thats not an issue.)

OpenFile(1,"C:\Users\xxxxxxx\Desktop\Test\PingResults.TXT, #MODE_READ")
Z$=(ReadLine(1)
If MidStr(Z$,49,3) = "TTL"
.
.
.
DownloadFile()
.
.
.
EndIf
AmigaOne X1000 - RadeonHD 7870, 4GB RAM - AmigaOS 4.1ß
AmigaOne X5000 - Radeon R7 250, 2GB RAM - AmigaOS 4.1ß
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Working with ftp timeouts

Post by airsoftsoftwair »

Hmm, is it not possible to simply use OpenConnection() to see if the server is up and then act accordingly?
Post Reply