Search the Community
Showing results for tags 'tcpstartup'.
Found 1 result
Hi. I'm working on a script to "round robin" through a list of Terminal Servers. the PC's host names are like "PC1", "PC2", "PC3", ... at each site, so I just use the "number suffix" to determine, which TS server shall be tried for *THIS* PC first, 2nd, 3rd (done, no problem). The issue is showing up, when a TS-Server is *NOT* available. Setting opt("tcptimeout",50) doesn't speed up the process, but I don't think, this is autoit related: it always takes quite a number of seconds to get the result, also with several other tools I've tried, that make use of the Win network APIs. So I suspect, that it's the Windows TCP/IP stack, that's the constraint (WinXP SP3 and Win7, x86 and x64). Question: Is there some "CMDline single EXE tool" / "some other approach", to get the up / open / closed status for an IP:TCPport pair instantly? nmap.exe is dependant on several files coming with it's installation (so fileinstall() would have to install quite a bunch of files), and it also doesn't return valuable exit codes representing it's results, otherwise fileinstall() and this line would be my friend: nmap -PS 192.168.188.111 -p 3389 There are quite a lot of very fast GUI IP scanning tools, but I couldn't find one for command line (ab-)use so far. Any suggestions appreciated, as I don't want to re-invent the wheel ;-) Regards, Rudi. Func CheckConnect($_IP, $_Port) Local $Err TCPStartup() ; Set Some reusable info ;-------------------------- Local $ConnectedSocket, $szData Opt("TCPTimeout", 50) ; Initialize a variable to represent a connection ;================================================== $ConnectedSocket = -1 ;Attempt to connect to SERVER at its IP and PORT specified ;=========================================================== $Socket = TCPConnect($_IP, $_Port) $Err = @error TCPShutdown() If $Err Then Switch $Err Case 1 SetError($Err) Return ("IP-Address invalid: " & $_IP & ":" & $_Port) Case 2 SetError($Err) Return ("Port-Addresse invalid: " & $_IP & ":" & $_Port) Case Else $Ping = Ping($_IP) If $Ping Then SetError($Err) Return ("PING time = " & $Ping & " - unknown error occured: " & $_IP & ":" & $_Port) Else SetError($Err) Return ("host not PINGable! ") EndIf EndSwitch Else Return True EndIf EndFunc ;==>CheckConnect