Jump to content
Sign in to follow this  
YpR^

Minor problem :)

Recommended Posts

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 by YpR^

Share this post


Link to post
Share on other sites

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 by YpR^

Share this post


Link to post
Share on other sites

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)
EndIf
and/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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...