kristoff Posted June 30, 2005 Posted June 30, 2005 Hi, I'm fighting with the error return code : What is the error code returned by $IP = TCPNameToIP($mnger) If the $mnger is resolved, @error return 0 If the $mnger is NOT resolved, @error return 0 So I would to trigger an action wheter the $mnger is resolved or not. if $mnger is resolved then ACTION1 else action2 Endif So I worte this, an of course I'm stuck #include <C:\scripts\autoit\311-beta54\include\GUIConstants.au3> $mnger = "ciao2323" TCPStartUp() $IP = TCPNameToIP($mnger) msgbox(0,"NAME ",$IP) msgbox(0,"ERROR CODE ",@error) if @error = 0 Then $var = Ping($mnger,250) If $var Then msgbox (0,"","================ " & $mnger & " is resolved to " & $IP & "================") msgbox (0,"","================ Rountrip was : " & $var & "================") ; Connect to a Listening "SOCKET" ;============================================== $socket = TCPConnect( $IP, 8080 ) If $socket = -1 Then msgbox(0,"PORT"," GO FISHING PORT IS CLOSED ") msgbox (0,""," =============== PORT IS CLOSED ========== ") else msgbox(0,"PORT"," PORT OPEN ") msgbox (0,""," =============== PORT IS OPEN ..========== ") Endif Endif else msgbox (0,"","================ " & $mnger & " is NOT resolved ================") msgbox (0,"","================ PLEASE ENSURE " & $mnger & "NETBIOS NAME IS CORRECTLY RESOLVED ================") Endif TCPShutdown ( ) Anyone to explain me clearly what's happened here Many thanks in advance
kristoff Posted June 30, 2005 Author Posted June 30, 2005 Hi, Found the trick, by testing the IP value, if value is "" ( null ) or not. cheers
jpm Posted June 30, 2005 Posted June 30, 2005 Hi,Found the trick, by testing the IP value, if value is "" ( null ) or not.cheers<{POST_SNAPBACK}>in fact the @error is reset by your msgbox(..) you need to save @error in a variable just after the call and test later on the variable
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