283 |
|
' Remove linefeeds and returns from the line. |
284 |
|
response = Replace(response, Chr(13), "") |
285 |
|
response = Replace(response, Chr(10), "") |
286 |
– |
'Text4.Text = Text4.Text & vbCrLf & response |
286 |
|
|
287 |
|
If connected = False Then |
288 |
|
' Perform TCP configuration (1.1) |
298 |
|
lastModified = response |
299 |
|
Text1.Text = Text1.Text & response & vbCrLf |
300 |
|
TCPSock.SendData "FILELIST" & vbCrLf |
301 |
< |
''' Uncomment this for new protocol release. |
303 |
< |
'Case 2a: |
304 |
< |
'If response = "ERROR" Then GoTo configError |
305 |
< |
'fileList = response |
306 |
< |
'Text1.Text = Text1.Text & response & vbCrLf |
307 |
< |
'TCPSock.SendData "FQDN" & vbCrLf |
301 |
> |
' New addition to the protocol. |
302 |
|
Case 3: |
303 |
|
If response = "ERROR" Then GoTo configError |
304 |
|
fileList = response |
305 |
|
Text1.Text = Text1.Text & response & vbCrLf |
306 |
< |
' REMOVE above line, uncomment next |
313 |
< |
'machineName = response |
314 |
< |
TCPSock.SendData "UDPUpdateTime" & vbCrLf |
306 |
> |
TCPSock.SendData "FQDN" & vbCrLf |
307 |
|
Case 4: |
308 |
|
If response = "ERROR" Then GoTo configError |
309 |
+ |
Text1.Text = Text1.Text & response & vbCrLf |
310 |
+ |
machineName = response |
311 |
+ |
TCPSock.SendData "UDPUpdateTime" & vbCrLf |
312 |
+ |
Case 5: |
313 |
+ |
If response = "ERROR" Then GoTo configError |
314 |
|
UDPUpdateTime = response |
315 |
|
Text1.Text = Text1.Text & response & vbCrLf |
316 |
|
TCPSock.SendData "TCPUpdateTime" & vbCrLf |
317 |
< |
Case 5: |
317 |
> |
Case 6: |
318 |
|
If response = "ERROR" Then GoTo configError |
319 |
|
TCPUpdateTime = response |
320 |
|
Text1.Text = Text1.Text & response & vbCrLf |
321 |
|
TCPSock.SendData "ENDCONFIG" & vbCrLf |
322 |
< |
Case 6: |
322 |
> |
Case 7: |
323 |
|
If Not response = "OK" Then GoTo configError |
324 |
|
Text1.Text = Text1.Text & response & vbCrLf |
325 |
|
TCPSock.SendData "FILTER" & vbCrLf |
326 |
< |
Case 7: |
326 |
> |
Case 8: |
327 |
|
Text1.Text = Text1.Text & response & vbCrLf |
328 |
|
'we got a filter list here. |
329 |
|
readTo = 0 |
338 |
|
' get TCP Port number |
339 |
|
filterTCPPort = response |
340 |
|
TCPSock.SendData "END" & vbCrLf |
341 |
< |
Case 8: |
341 |
> |
Case 9: |
342 |
|
If Not response = "OK" Then GoTo configError |
343 |
|
connected = True |
344 |
|
responseNumber = 0 |
404 |
|
seqNo = seqNo + 1 |
405 |
|
|
406 |
|
' Comment this line in the next protocol |
407 |
< |
machineName = TCPSock.LocalHostName |
407 |
> |
'machineName = TCPSock.LocalHostName |
408 |
|
|
409 |
|
LocalIP = TCPSock.LocalIP |
410 |
|
packetDate = Date2Num() |
444 |
|
Dim memory& |
445 |
|
GlobalMemoryStatus memsts |
446 |
|
memory& = memsts.dwTotalPhys |
447 |
< |
memTotal = memory& \ 1024 |
447 |
> |
memTotal = memory& \ 1048576 |
448 |
|
memory& = memsts.dwAvailPhys |
449 |
< |
memFree = memory& \ 1024 |
449 |
> |
memFree = memory& \ 1048576 |
450 |
|
memory& = memsts.dwTotalVirtual |
451 |
< |
swapTotal = memory& \ 1024 |
451 |
> |
swapTotal = memory& \ 1048576 |
452 |
|
memory& = memsts.dwAvailVirtual |
453 |
< |
swapFree = memory& \ 1024 |
453 |
> |
swapFree = memory& \ 1048576 |
454 |
|
|
455 |
|
uptime = CUpTime.MilliSecs \ 1000 |
456 |
|
|
458 |
|
cpu_time = CUpTime.CPUTime |
459 |
|
percent_idle = CUpTime.PercentIdle |
460 |
|
|
461 |
+ |
userCount = wksta.LoggedOnUsers |
462 |
+ |
|
463 |
|
' build the contents of the XML packet |
464 |
|
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & LocalIP & """>" & _ |
465 |
|
"<os>" & _ |
471 |
|
"<processor>" & processorType & "</processor>" & _ |
472 |
|
"<uptime>" & uptime & "</uptime>" & _ |
473 |
|
"</os>" & _ |
474 |
+ |
"<users><count>" & userCount & "</count></users>" & _ |
475 |
|
"<cpu><idle>" & percent_idle & "</idle><user>" & cpu_time & "</user></cpu>" & _ |
476 |
|
"<memory><total>" & memTotal & "</total><free>" & memFree & "</free></memory>" & _ |
477 |
|
"<swap><total>" & swapTotal & "</total><free>" & swapFree & "</free></swap>" & _ |