154 |
|
|
155 |
|
Dim protocolVersion As String |
156 |
|
Dim connected As Boolean |
157 |
+ |
Dim heartBeating As Boolean |
158 |
|
|
159 |
|
Dim CUpTime As New CUpTime |
160 |
|
Dim wksta As New CNetWksta |
250 |
|
SystemTray.Icon = Val(Form1.Icon) |
251 |
|
End Sub |
252 |
|
|
252 |
– |
Private Sub Image1_Click() |
253 |
|
|
254 |
– |
End Sub |
255 |
– |
|
254 |
|
Private Sub Reconfigure_Click() |
255 |
|
' establish a TCP connection to a filtermanager |
256 |
< |
connected = False |
257 |
< |
TCPSock.Close |
258 |
< |
TCPSock.Connect filterManagerHostname, filterManagerTCPPort |
256 |
> |
If Not heartBeating Then |
257 |
> |
connected = False |
258 |
> |
TCPSock.Close |
259 |
> |
TCPSock.Connect filterManagerHostname, filterManagerTCPPort |
260 |
> |
Else |
261 |
> |
Status.Caption = "Cannot reconfigure while heartbeating" |
262 |
> |
End If |
263 |
|
End Sub |
264 |
|
|
265 |
|
|
365 |
|
End Select |
366 |
|
Else |
367 |
|
' Perform a heartbeat (1.1) |
368 |
+ |
heartBeating = True |
369 |
|
On Error GoTo heartbeatError |
370 |
|
Select Case responseNumber |
371 |
|
Case 1: |
382 |
|
Text1.Text = Text1.Text & response & vbCrLf |
383 |
|
TCPSock.SendData lastModified & vbCrLf |
384 |
|
Case 4: |
385 |
< |
If Not response = "OK" Then GoTo heartbeatError |
385 |
> |
If Not response = "OK" Then |
386 |
> |
heartBeating = False |
387 |
> |
Reconfigure_Click |
388 |
> |
End If |
389 |
|
Text1.Text = Text1.Text & response & vbCrLf |
390 |
|
TCPSock.SendData "ENDHEARTBEAT" & vbCrLf |
391 |
|
Case 5: |
401 |
|
Exit Sub |
402 |
|
|
403 |
|
configError: |
404 |
< |
Status.Caption = "FAILED to get configuration" |
404 |
> |
heartBeating = False |
405 |
> |
Status.Caption = "FAILED to get configuration from the server" |
406 |
|
Exit Sub |
407 |
|
heartbeatError: |
408 |
+ |
heartBeating = False |
409 |
|
Status.Caption = "Heatbeat FAILED" |
410 |
|
Exit Sub |
411 |
|
End Sub |
474 |
|
cpu_time = CUpTime.CPUTime |
475 |
|
percent_idle = CUpTime.PercentIdle |
476 |
|
|
469 |
– |
'' Causes numbers to be too big :-/ |
470 |
– |
'uptime = CUpTime.MilliSecs \ 1000 |
471 |
– |
|
477 |
|
'' Doesn't work after 47 days :-/ |
478 |
|
'uptime = GetTickCount \ 1000 |
479 |
|
|
480 |
< |
secondsRunning = secondsRunning + UDPUpdateTime |
481 |
< |
uptime = secondsRunning |
480 |
> |
'secondsRunning = secondsRunning + UDPUpdateTime |
481 |
> |
'uptime = secondsRunning |
482 |
|
|
483 |
+ |
uptime = CUpTime.MilliSecs / 1000# |
484 |
+ |
|
485 |
|
userCount = wksta.LoggedOnUsers |
486 |
|
|
487 |
|
' build the contents of the XML packet |
489 |
|
"<os>" & _ |
490 |
|
"<netbios_name>" & netbiosName & "</netbios_name>" & _ |
491 |
|
"<name>" & osName & "</name>" & _ |
492 |
< |
"<version>" & osVersionMajor & "</version>" & _ |
492 |
> |
"<version>" & osVersionMajor & "." & osVersionMinor & "</version>" & _ |
493 |
|
"<release>" & osBuild & "</release>" & _ |
494 |
< |
"<platform>" & osName & "</platform>" & _ |
488 |
< |
"<minor_version>" & osVersionMinor & "</minor_version>" & _ |
489 |
< |
"<processor>" & processorType & "</processor>" & _ |
494 |
> |
"<platform>" & processorType & "</platform>" & _ |
495 |
|
"<uptime>" & uptime & "</uptime>" & _ |
496 |
|
"</os>" & _ |
497 |
|
"<users><count>" & userCount & "</count></users>" & _ |