YpR^ Posted April 17, 2005 Share Posted April 17, 2005 (edited) I have a script which sends some data to an FTP server. Afterwards it runs a mainscript. BUT i just realised that the mainscript doesn't start if the server i'm uploading / downloading to/from doesn't respond... hmm... Is it possible to check the status of the FTP? And if it respond it'll send / get the file. If the server doesn't respond i'll just jump that "section" and start the manscript... Thank you Edited April 17, 2005 by YpR^ Link to comment Share on other sites More sharing options...
Helge Posted April 17, 2005 Share Posted April 17, 2005 Ping("ftp.myftp.com")? Link to comment Share on other sites More sharing options...
YpR^ Posted April 17, 2005 Author Share Posted April 17, 2005 (edited) Im getting error 4 and/or 1 ... when using the standard script... $var = Ping("www.hiddensoft.com",250) If $var Then; also possible: If @error = 0 Then ... Msgbox(0,"Status","Online, roundtrip was:" & $var) Else Msgbox(0,"Status","An error occured with number: " & @error) EndIf Remarks When the function fails (returns 0) @error contains extended information: 1 = Host is offline 2 = Host is unreachable 3 = Bad destination 4 = Other errors but... the FTP server IS online ! Btw... how should i enter the FTP server? $var = Ping("ftp://myftpserver.net",250) $var = Ping("myftpserver.net",250) $var = Ping("other ways to enter it ?",250) Edited April 17, 2005 by YpR^ Link to comment Share on other sites More sharing options...
Westi Posted April 17, 2005 Share Posted April 17, 2005 Increase the timeout to 4000ms (standard):$var = Ping("www.hiddensoft.com") If $var Then Msgbox(0,"Status","Online, roundtrip was:" & $var) Else Msgbox(0,"Status","An error occured with number: " & @error) EndIfand/or make a dummy connection and check the result:$size = InetGetSize("ftp://yourserver.com/dummy.txt") If $size = 0 then MsgBox(0, "Error", "Connecting failed...) Exit EndIf If $size = 15 then ;15 is only an example ... EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now