--- projects/cms/source/host/winhost/nettest.frm 2001/02/28 12:04:17 1.31
+++ projects/cms/source/host/winhost/nettest.frm 2001/03/19 13:02:36 1.38
@@ -4,25 +4,25 @@ Object = "{33155A3D-0CE0-11D1-A6B4-444553540000}#1.0#0
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "i-scream Winhost"
- ClientHeight = 1185
+ ClientHeight = 1380
ClientLeft = 45
ClientTop = 330
- ClientWidth = 4710
+ ClientWidth = 4635
Icon = "nettest.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
- ScaleHeight = 1185
- ScaleWidth = 4710
+ ScaleHeight = 1380
+ ScaleWidth = 4635
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Visible = 0 'False
Begin VB.CommandButton Command1
Caption = "more"
Height = 255
- Left = 3960
+ Left = 3885
TabIndex = 8
- Top = 840
+ Top = 1035
Width = 615
End
Begin VB.TextBox Text1
@@ -32,15 +32,15 @@ Begin VB.Form Form1
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 7
- Top = 1200
- Width = 4455
+ Top = 1440
+ Width = 4395
End
Begin VB.CommandButton Hide
Caption = "hide"
Height = 255
- Left = 3960
+ Left = 3225
TabIndex = 6
- Top = 480
+ Top = 1035
Width = 615
End
Begin SysTray.SystemTray SystemTray
@@ -60,7 +60,7 @@ Begin VB.Form Form1
Height = 375
Left = 840
TabIndex = 0
- Top = 3480
+ Top = 3555
Width = 2895
End
Begin MSWinsockLib.Winsock TCPSock
@@ -78,13 +78,20 @@ Begin VB.Form Form1
_Version = 393216
Protocol = 1
End
+ Begin VB.Image Image1
+ Height = 900
+ Left = 2400
+ Picture = "nettest.frx":08CA
+ Top = 90
+ Width = 2100
+ End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "Next heartbeat:"
Height = 255
Left = 120
TabIndex = 5
- Top = 480
+ Top = 645
Width = 1455
End
Begin VB.Label Label1
@@ -93,7 +100,7 @@ Begin VB.Form Form1
Height = 255
Left = 120
TabIndex = 4
- Top = 120
+ Top = 165
Width = 1455
End
Begin VB.Label Label4
@@ -102,7 +109,7 @@ Begin VB.Form Form1
Height = 255
Left = 1680
TabIndex = 3
- Top = 480
+ Top = 645
Width = 615
End
Begin VB.Label Label3
@@ -111,7 +118,7 @@ Begin VB.Form Form1
Height = 255
Left = 1680
TabIndex = 2
- Top = 120
+ Top = 165
Width = 615
End
Begin VB.Label Status
@@ -120,8 +127,8 @@ Begin VB.Form Form1
Height = 255
Left = 0
TabIndex = 1
- Top = 840
- Width = 3855
+ Top = 1035
+ Width = 3180
End
End
Attribute VB_Name = "Form1"
@@ -139,17 +146,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
@@ -163,10 +175,10 @@ Private Sub Command1_Click()
' Toggle visibility of the debug output.
If windowBig Then
- Form1.Height = 1500
+ Form1.Height = 1755
windowBig = False
Else
- Form1.Height = 4350
+ Form1.Height = 4380
windowBig = True
End If
@@ -179,6 +191,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,15 +257,16 @@ Private Sub Hide_Click()
SystemTray.Icon = Val(Form1.Icon)
End Sub
-Private Sub Image1_Click()
-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
@@ -356,6 +372,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:
@@ -372,7 +389,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:
@@ -388,9 +408,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
@@ -455,12 +477,18 @@ 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
@@ -468,11 +496,9 @@ Private Sub Timer1_Timer()
"" & _
"" & netbiosName & "" & _
"" & osName & "" & _
- "" & osVersionMajor & "" & _
+ "" & osVersionMajor & "." & osVersionMinor & "" & _
"" & osBuild & "" & _
- "" & osName & "" & _
- "" & osVersionMinor & "" & _
- "" & processorType & "" & _
+ "" & processorType & "" & _
"" & uptime & "" & _
"" & _
"" & userCount & "" & _