Check if server online without A3 Client

Results 1 to 1 of 1
  1. #1
    Goodbye chrissdegrece is offline
    MemberRank
    Oct 2009 Join Date
    GreeceLocation
    1,015Posts

    cool Check if server online without A3 Client

    Hi guys,

    I made a simple prog to test if an FTP server is online. You can use it with any type of server, web, Ftp, SMTP and of course with A3 Servers.

    It's made using autoit, all you have to do is enter IP address and port.

    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

    online.jpg

    offline.jpg
    Last edited by chrissdegrece; 18-08-10 at 01:18 PM.




Advertisement