rudi Posted November 22, 2012 Posted November 22, 2012 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 3389There 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.expandcollapse popupFunc 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 Earth is flat, pigs can fly, and Nuclear Power is SAFE!
rudi Posted November 26, 2012 Author Posted November 26, 2012 Bump. Any suggestions or ideas, anybody?? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
rudi Posted December 12, 2012 Author Posted December 12, 2012 (edited) Hi.Hamish (Novell Support Forums, -> chat) pointed out, that there are two different "flavours" of sockets:blocking socketsnon-blocking socketsI guess, that the Autoit built in network functions use blocking sockets.Is it possible to force these autoit functions to use http://www.scottklement.com/rpg/socktut/nonblocking.html non-blocking sockets?Regards, Rudi. Edited December 12, 2012 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE!
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