We have several servers and I'm writing a server status monitor. I am trying to quickly determine if I can FTP to each of our local servers. When I successfully do an _FTP_Open(), then call _FTP_Connect(), the _FTP_Connect takes around 45 seconds to time out.
I want to make the 'FTP-ability' test to take no more than 1 or 2 seconds.
Is there a way to change the _FTP_Connect() timeout? Perhaps there is another call I could use?
Here is my sample code (with my server credentials removed).
#include <FTPEx.au3>
#include <array.au3>
_Main()
Exit (0)
Func _Main()
Local $server, $uname, $pwd, $hSession, $iID, $bRet
$server = "xxxxx"
$uname = "xxxxx"
$pwd = "xxxx"
$hSession = _FTP_Open('MyFTP')
If $hSession <> 0 Then
$iID = _FTP_Connect($hSession, $server, $uname, $pwd, 1, 21)
ConsoleWrite("Can connect OK" & @CRLF)
If ($iID <> 0) Then
Else
ConsoleWrite("Connect FAILED" & @CRLF)
EndIf
_FTP_Close($hSession)
Else
ConsoleWrite("+++: Openfailed" & @CRLF)
EndIf
EndFunc ;==>_Main