Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 411, 106, 192, 114)
$Label1 = GUICtrlCreateLabel("Server IP", 8, 16, 48, 17)
$Label2 = GUICtrlCreateLabel("Server port", 193, 16, 56, 17)
$IPort = GUICtrlCreateInput("21", 254, 14, 41, 21)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 56, 14, 130, 21)
_GUICtrlIpAddress_Set($IPAddress1, "192.168.1.1")
$Button1 = GUICtrlCreateButton("Check ", 312, 16, 75, 25)
GUICtrlSetOnEvent($Button1, "CheckClicked")
$LbResult = GUICtrlCreateLabel("Result:", 72, 56, 269, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
Opt("GUIOnEventMode", 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
sleep(1000)
WEnd
Func CheckClicked()
;Note: at this point @GUI_CTRLID would equal $okbutton,
;and @GUI_WINHANDLE would equal $mainwindow
TCPStartup()
$serverip = _GUICtrlIpAddress_Get($IPAddress1) ;GUICtrlRead($IPAddress1)
GUICtrlSetBkColor($LbResult, 0xFFFFFF)
GUICtrlSetData($LbResult, "Checking please wait...")
$serverport = GUICtrlRead($IPort)
TCPConnect($serverip, $serverport) ;replace port with the port number
If @Error Then
TCPShutdown()
GUICtrlSetBkColor($LbResult, 0xFF0000)
GUICtrlSetData($LbResult, "O F F L I N E")
Else
GUICtrlSetBkColor($LbResult, 0x00FF00)
GUICtrlSetData($LbResult, "O N L I N E")
EndIf
EndFunc
Func CLOSEClicked()
;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
;and @GUI_WINHANDLE would equal $mainwindow
;MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
Exit
EndFunc
Download autoit, copy/paste code and run