--- projects/cms/source/host/winhost/nettest.frm 2001/02/28 10:45:37 1.29 +++ projects/cms/source/host/winhost/nettest.frm 2001/03/19 09:35:56 1.35 @@ -139,17 +139,22 @@ Dim filterManagerTCPPort As Long Dim seqNo As Long Dim machineName As String +Dim secondsRunning As Long + Dim filterHostname As String Dim filterTCPPort As Integer Dim filterUDPPort As Integer Dim fileList As String Dim lastModified As String +Dim fourtySevenDays As Integer + Dim UDPUpdateTime As Integer Dim TCPUpdateTime As Integer Dim protocolVersion As String Dim connected As Boolean +Dim heartBeating As Boolean Dim CUpTime As New CUpTime Dim wksta As New CNetWksta @@ -179,6 +184,9 @@ Private Sub Form_Load() End End If + ' Assume the host is run within the first 47 days of the machine starting. + fourtySevenDays = 0 + protocolVersion = "1.1" Status.Caption = "Loading" @@ -242,11 +250,16 @@ Private Sub Hide_Click() SystemTray.Icon = Val(Form1.Icon) End Sub + Private Sub Reconfigure_Click() ' establish a TCP connection to a filtermanager - connected = False - TCPSock.Close - TCPSock.Connect filterManagerHostname, filterManagerTCPPort + If Not heartBeating Then + connected = False + TCPSock.Close + TCPSock.Connect filterManagerHostname, filterManagerTCPPort + Else + Status.Caption = "Cannot reconfigure while heartbeating" + End If End Sub @@ -352,6 +365,7 @@ Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo End Select Else ' Perform a heartbeat (1.1) + heartBeating = True On Error GoTo heartbeatError Select Case responseNumber Case 1: @@ -368,7 +382,10 @@ Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo Text1.Text = Text1.Text & response & vbCrLf TCPSock.SendData lastModified & vbCrLf Case 4: - If Not response = "OK" Then GoTo heartbeatError + If Not response = "OK" Then + heartBeating = False + Reconfigure_Click + End If Text1.Text = Text1.Text & response & vbCrLf TCPSock.SendData "ENDHEARTBEAT" & vbCrLf Case 5: @@ -384,9 +401,11 @@ Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo Exit Sub configError: - Status.Caption = "FAILED to get configuration" + heartBeating = False + Status.Caption = "FAILED to get configuration from the server" Exit Sub heartbeatError: + heartBeating = False Status.Caption = "Heatbeat FAILED" Exit Sub End Sub @@ -403,8 +422,7 @@ Private Sub Timer1_Timer() ' prepare the contents of the XML packet. seqNo = seqNo + 1 - ' Comment this line in the next protocol - 'machineName = TCPSock.LocalHostName + netbiosName = TCPSock.LocalHostName LocalIP = TCPSock.LocalIP packetDate = Date2Num() @@ -452,23 +470,29 @@ Private Sub Timer1_Timer() memory& = memsts.dwAvailVirtual swapFree = memory& \ 1048576 - uptime = CUpTime.MilliSecs \ 1000 - CUpTime.Capture cpu_time = CUpTime.CPUTime percent_idle = CUpTime.PercentIdle + '' Doesn't work after 47 days :-/ + 'uptime = GetTickCount \ 1000 + + 'secondsRunning = secondsRunning + UDPUpdateTime + 'uptime = secondsRunning + + uptime = CUpTime.MilliSecs / 1000# + userCount = wksta.LoggedOnUsers ' build the contents of the XML packet xml = "" & _ "" & _ + "" & netbiosName & "" & _ "" & osName & "" & _ - "" & osVersionMajor & "" & _ + "" & osVersionMajor & "." & osVersionMinor & "" & _ "" & osBuild & "" & _ "" & osName & "" & _ - "" & osVersionMinor & "" & _ - "" & processorType & "" & _ + "" & processorType & "" & _ "" & uptime & "" & _ "" & _ "" & userCount & "" & _