Sign in to follow this  
Followers 0
ntbushwick

Check remote TCP Port

8 posts in this topic

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.

Share this post


Link to post
Share on other sites



Look at these network functions:

TCPStartUp()

TCPConnect()

TCPCloseSocket()

TCPShutDown()

Roy :( .

Share this post


Link to post
Share on other sites

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" )

Share this post


Link to post
Share on other sites

kristoff, those functions are now included in the beta release. The Dll is no longer necessary for TCP functions.

Share this post


Link to post
Share on other sites

Thanks Saunders, Can I have more info please or point me to the right link, do not find anything regarding this :(

TIA

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by kristoff

Share this post


Link to post
Share on other sites

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())

Share this post


Link to post
Share on other sites

sure Tx

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0