ntbushwick Posted June 14, 2005 Posted June 14, 2005 I am not trying to port scan servers. I just need to verify a port on my server is always available, so that my application can always connect to it. How can I use autoit to check to see if a specifc port is listening on a server? Thanks.
roy Posted June 14, 2005 Posted June 14, 2005 Look at these network functions: TCPStartUp() TCPConnect() TCPCloseSocket() TCPShutDown() Roy .
kristoff Posted June 15, 2005 Posted June 15, 2005 Hi, Download AU3Xtra.dll from Larry's web, see examples in the zipped file Something like : $dest="bumper" $port = "8080" DLLCall( "AU3Xtra.dll", "int", "TCPStartUp" ) $var = DLLCall( "AU3Xtra.dll", "int", "TCPNameToIP", "str", $dest, "str", "" ) $socket = DLLCall( "AU3Xtra.dll", "int", "TCPConnect", "str", $var[2], "int", $port ) If @error Or $socket[0] < 0 Then Msgbox(0,'PORT STATUS',"NOT OK" ) else Msgbox(0,'PORT STATUS', "OK" ) Endif DLLCall( "AU3Xtra.dll", "int", "TCPShutDown" )
therks Posted June 15, 2005 Posted June 15, 2005 kristoff, those functions are now included in the beta release. The Dll is no longer necessary for TCP functions. My AutoIt Stuff | My Github
kristoff Posted June 15, 2005 Posted June 15, 2005 Thanks Saunders, Can I have more info please or point me to the right link, do not find anything regarding this TIA
kristoff Posted June 15, 2005 Posted June 15, 2005 (edited) Oppss ! Actually...........Really much easier : :"> ..and easily affordable Require beta 31148 #include <C:\Scripts\AutoItV3\beta311-48\include\GUIConstants.au3> ; Start The TCP Services ;============================================== TCPStartUp() ;CLIENT!!!!!!!! Start SERVER First... dummy!! $g_name = "4test" $IP = TCPNameToIP($g_name) msgbox(0,"NAME ",$IP) ; Connect to a Listening "SOCKET" ;============================================== $socket = TCPConnect( $IP, 80 ) If $socket = -1 Then msgbox(0,"PORT"," GO FISHING PORT IS CLOSED ") else msgbox(0,"PORT"," PORT OPEN ") Endif Looking forward this release of AutoIt in production, great tx to dvpt team Edited June 15, 2005 by kristoff
MSLx Fanboy Posted June 16, 2005 Posted June 16, 2005 Don't forget to close the socket you created (sorry, I have to close anything I open, I'm anal retentive about that ). The beta version can be found in the Developers forum, under 3.1.1++ topic. Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
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