Jump to content
lrave1

Help Deleting Inactive Timer - TCP Computer Monitor

Recommended Posts

Hi Can Someone help me with this as it is confusing me. I'm trying to make is so that when a computer goes inactive according the the timerint line. It gets deleted from the table. At the moment the if a computer closes the tcp connection it will create a new line. Thanks in advance.

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

GUICreate("Communication Utility Monitor", 1000, 500)
$hListView = GUICtrlCreateListView("ID|PC Name|Operating system|Last Connection|Status|Status|Status|Status|Status|timeint", -1, -1, 1000, 227)
_GUICtrlListView_AddItem($hListView, "1", 0)
_GUICtrlListView_AddItem($hListView, "2", 0)
_GUICtrlListView_AddItem($hListView, "3", 0)
_GUICtrlListView_AddItem($hListView, "4", 0)
_GUICtrlListView_AddItem($hListView, "5", 0)
_GUICtrlListView_AddItem($hListView, "6", 0)
_GUICtrlListView_AddItem($hListView, "7", 0)
GUISetState()
TCPStartup()
Dim $Socket_Data[1]
$Socket_Data[0] = 0
$Listen = TCPListen('192.168.1.1', 65434, 500)
While 1
    For $x = $Socket_Data[0] To 1 Step -1
       $Recv = TCPRecv($Socket_Data[$x], 1000000)
        If $Recv Then
$data = StringSplit($Recv,'$')
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[1],1)
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[2],2)
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[3],3)
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[4],4)
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[5],5)
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[6],6)
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[7],7)
_GUICtrlListView_AddSubItem($hListView,$x-1,$data[8],8)
_GUICtrlListView_AddSubItem($hListView,$x-1,TimerInit(),9)
        EndIf
    Next
    _Accept()
WEnd
Func _Accept()
    Local $Accept = TCPAccept($Listen)
    If $Accept <> -1 Then
        _ArrayAdd($Socket_Data, $Accept)
        $Socket_Data[0] += 1
    EndIf
 EndFunc   ;==>_Accept

Share this post


Link to post
Share on other sites

Sure Can. There is more attached to the script but this is the TCP connect and send part

TCPStartup()
            $Socket = TCPConnect($server, $port)
 While 1
    $timer = TimerInit()
    Do
        If TimerDiff($timer) > $tinterval Then
        EndIf
            Call("RRTcheck")
            Call("VNCcheck")
            Call("SRVcheck")
            Sleep($slptime)
            Call("UpdateRRTCheck")
            Call("UpdateVNCCheck")
            Call("UpdateSRVCheck")
            Call("CSCStatusCheck")
            Call("UpdateTroubleshooter")
            Call("INTcheck")
            Call("UpdateINTCheck")
            TCPSend($socket, @ComputerName &'$'& @IPAddress1 &'$'& @OSVersion &'$'& @MDAY & "/" & @MON & "/" & @YEAR & "-" & @HOUR & ":" & @MIN &'$'& $statusPLEX &'$'& $statusSAB &'$'& $statusSICK &'$'& $statusLOG &'$'& $statusVNC)
            Sleep(1000)
    Until TimerDiff($timer) > $tinterval
    $timer = 0
WEnd

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

×
×
  • Create New...