ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/winhost/nettest.frm
(Generate patch)

Comparing projects/cms/source/host/winhost/nettest.frm (file contents):
Revision 1.28 by pjm2, Wed Feb 28 09:24:53 2001 UTC vs.
Revision 1.37 by pjm2, Mon Mar 19 10:32:43 2001 UTC

# Line 4 | Line 4 | Object = "{33155A3D-0CE0-11D1-A6B4-444553540000}#1.0#0
4   Begin VB.Form Form1
5     BorderStyle     =   3  'Fixed Dialog
6     Caption         =   "i-scream Winhost"
7 <   ClientHeight    =   1185
7 >   ClientHeight    =   1380
8     ClientLeft      =   45
9     ClientTop       =   330
10 <   ClientWidth     =   4710
10 >   ClientWidth     =   4635
11     Icon            =   "nettest.frx":0000
12     LinkTopic       =   "Form1"
13     MaxButton       =   0   'False
14     MinButton       =   0   'False
15 <   ScaleHeight     =   1185
16 <   ScaleWidth      =   4710
15 >   ScaleHeight     =   1380
16 >   ScaleWidth      =   4635
17     ShowInTaskbar   =   0   'False
18     StartUpPosition =   2  'CenterScreen
19     Visible         =   0   'False
20     Begin VB.CommandButton Command1
21        Caption         =   "more"
22        Height          =   255
23 <      Left            =   3960
23 >      Left            =   3885
24        TabIndex        =   8
25 <      Top             =   840
25 >      Top             =   1035
26        Width           =   615
27     End
28     Begin VB.TextBox Text1
# Line 32 | Line 32 | Begin VB.Form Form1
32        MultiLine       =   -1  'True
33        ScrollBars      =   2  'Vertical
34        TabIndex        =   7
35 <      Top             =   1200
36 <      Width           =   4455
35 >      Top             =   1440
36 >      Width           =   4395
37     End
38     Begin VB.CommandButton Hide
39        Caption         =   "hide"
40        Height          =   255
41 <      Left            =   3960
41 >      Left            =   3225
42        TabIndex        =   6
43 <      Top             =   480
43 >      Top             =   1035
44        Width           =   615
45     End
46     Begin SysTray.SystemTray SystemTray
# Line 60 | Line 60 | Begin VB.Form Form1
60        Height          =   375
61        Left            =   840
62        TabIndex        =   0
63 <      Top             =   3480
63 >      Top             =   3555
64        Width           =   2895
65     End
66     Begin MSWinsockLib.Winsock TCPSock
# Line 78 | Line 78 | Begin VB.Form Form1
78        _Version        =   393216
79        Protocol        =   1
80     End
81 +   Begin VB.Image Image1
82 +      Height          =   900
83 +      Left            =   2400
84 +      Picture         =   "nettest.frx":0742
85 +      Top             =   90
86 +      Width           =   2100
87 +   End
88     Begin VB.Label Label2
89        Alignment       =   1  'Right Justify
90        Caption         =   "Next heartbeat:"
91        Height          =   255
92        Left            =   120
93        TabIndex        =   5
94 <      Top             =   480
94 >      Top             =   645
95        Width           =   1455
96     End
97     Begin VB.Label Label1
# Line 93 | Line 100 | Begin VB.Form Form1
100        Height          =   255
101        Left            =   120
102        TabIndex        =   4
103 <      Top             =   120
103 >      Top             =   165
104        Width           =   1455
105     End
106     Begin VB.Label Label4
# Line 102 | Line 109 | Begin VB.Form Form1
109        Height          =   255
110        Left            =   1680
111        TabIndex        =   3
112 <      Top             =   480
112 >      Top             =   645
113        Width           =   615
114     End
115     Begin VB.Label Label3
# Line 111 | Line 118 | Begin VB.Form Form1
118        Height          =   255
119        Left            =   1680
120        TabIndex        =   2
121 <      Top             =   120
121 >      Top             =   165
122        Width           =   615
123     End
124     Begin VB.Label Status
# Line 120 | Line 127 | Begin VB.Form Form1
127        Height          =   255
128        Left            =   0
129        TabIndex        =   1
130 <      Top             =   840
131 <      Width           =   3855
130 >      Top             =   1035
131 >      Width           =   3180
132     End
133   End
134   Attribute VB_Name = "Form1"
# Line 139 | Line 146 | Dim filterManagerTCPPort As Long
146   Dim seqNo As Long
147   Dim machineName As String
148  
149 + Dim secondsRunning As Long
150 +
151   Dim filterHostname As String
152   Dim filterTCPPort As Integer
153   Dim filterUDPPort As Integer
154   Dim fileList As String
155   Dim lastModified As String
156  
157 + Dim fourtySevenDays As Integer
158 +
159   Dim UDPUpdateTime As Integer
160   Dim TCPUpdateTime As Integer
161  
162   Dim protocolVersion As String
163   Dim connected As Boolean
164 + Dim heartBeating As Boolean
165  
166   Dim CUpTime As New CUpTime
167   Dim wksta As New CNetWksta
# Line 163 | Line 175 | Private Sub Command1_Click()
175      ' Toggle visibility of the debug output.
176  
177      If windowBig Then
178 <        Form1.Height = 1500
178 >        Form1.Height = 1755
179          windowBig = False
180      Else
181 <        Form1.Height = 4350
181 >        Form1.Height = 4380
182          windowBig = True
183      End If
184  
# Line 179 | Line 191 | Private Sub Form_Load()
191          End
192      End If
193      
194 +    ' Assume the host is run within the first 47 days of the machine starting.
195 +    fourtySevenDays = 0
196 +    
197      protocolVersion = "1.1"
198      
199      Status.Caption = "Loading"
# Line 242 | Line 257 | Private Sub Hide_Click()
257      SystemTray.Icon = Val(Form1.Icon)
258   End Sub
259  
260 +
261   Private Sub Reconfigure_Click()
262      ' establish a TCP connection to a filtermanager
263 <    connected = False
264 <    TCPSock.Close
265 <    TCPSock.Connect filterManagerHostname, filterManagerTCPPort
263 >    If Not heartBeating Then
264 >        connected = False
265 >        TCPSock.Close
266 >        TCPSock.Connect filterManagerHostname, filterManagerTCPPort
267 >    Else
268 >        Status.Caption = "Cannot reconfigure while heartbeating"
269 >    End If
270   End Sub
271  
272  
# Line 283 | Line 303 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
303      ' Remove linefeeds and returns from the line.
304      response = Replace(response, Chr(13), "")
305      response = Replace(response, Chr(10), "")
286    'Text4.Text = Text4.Text & vbCrLf & response
306      
307      If connected = False Then
308          ' Perform TCP configuration (1.1)
# Line 299 | Line 318 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
318                  lastModified = response
319                  Text1.Text = Text1.Text & response & vbCrLf
320                  TCPSock.SendData "FILELIST" & vbCrLf
321 <            ''' 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
321 >            ' New addition to the protocol.
322              Case 3:
323                  If response = "ERROR" Then GoTo configError
324                  fileList = response
325                  Text1.Text = Text1.Text & response & vbCrLf
326 <                ' REMOVE above line, uncomment next
313 <                'machineName = response
314 <                TCPSock.SendData "UDPUpdateTime" & vbCrLf
326 >                TCPSock.SendData "FQDN" & vbCrLf
327              Case 4:
328                  If response = "ERROR" Then GoTo configError
329 +                Text1.Text = Text1.Text & response & vbCrLf
330 +                machineName = response
331 +                TCPSock.SendData "UDPUpdateTime" & vbCrLf
332 +            Case 5:
333 +                If response = "ERROR" Then GoTo configError
334                  UDPUpdateTime = response
335                  Text1.Text = Text1.Text & response & vbCrLf
336                  TCPSock.SendData "TCPUpdateTime" & vbCrLf
337 <            Case 5:
337 >            Case 6:
338                  If response = "ERROR" Then GoTo configError
339                  TCPUpdateTime = response
340                  Text1.Text = Text1.Text & response & vbCrLf
341                  TCPSock.SendData "ENDCONFIG" & vbCrLf
342 <            Case 6:
342 >            Case 7:
343                  If Not response = "OK" Then GoTo configError
344                  Text1.Text = Text1.Text & response & vbCrLf
345                  TCPSock.SendData "FILTER" & vbCrLf
346 <            Case 7:
346 >            Case 8:
347                  Text1.Text = Text1.Text & response & vbCrLf
348                  'we got a filter list here.
349                  readTo = 0
# Line 341 | Line 358 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
358                  ' get TCP Port number
359                  filterTCPPort = response
360                  TCPSock.SendData "END" & vbCrLf
361 <            Case 8:
361 >            Case 9:
362                  If Not response = "OK" Then GoTo configError
363                  connected = True
364                  responseNumber = 0
# Line 355 | Line 372 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
372          End Select
373      Else
374          ' Perform a heartbeat (1.1)
375 +        heartBeating = True
376          On Error GoTo heartbeatError
377          Select Case responseNumber
378              Case 1:
# Line 371 | Line 389 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
389                  Text1.Text = Text1.Text & response & vbCrLf
390                  TCPSock.SendData lastModified & vbCrLf
391              Case 4:
392 <                If Not response = "OK" Then GoTo heartbeatError
392 >                If Not response = "OK" Then
393 >                    heartBeating = False
394 >                    Reconfigure_Click
395 >                End If
396                  Text1.Text = Text1.Text & response & vbCrLf
397                  TCPSock.SendData "ENDHEARTBEAT" & vbCrLf
398              Case 5:
# Line 387 | Line 408 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
408      Exit Sub
409      
410   configError:
411 <    Status.Caption = "FAILED to get configuration"
411 >    heartBeating = False
412 >    Status.Caption = "FAILED to get configuration from the server"
413      Exit Sub
414   heartbeatError:
415 +    heartBeating = False
416      Status.Caption = "Heatbeat FAILED"
417      Exit Sub
418   End Sub
# Line 406 | Line 429 | Private Sub Timer1_Timer()
429          ' prepare the contents of the XML packet.
430          seqNo = seqNo + 1
431          
432 <        ' Comment this line in the next protocol
410 <        machineName = TCPSock.LocalHostName
432 >        netbiosName = TCPSock.LocalHostName
433          
434          LocalIP = TCPSock.LocalIP
435          packetDate = Date2Num()
# Line 447 | Line 469 | Private Sub Timer1_Timer()
469          Dim memory&
470          GlobalMemoryStatus memsts
471          memory& = memsts.dwTotalPhys
472 <        memTotal = memory& \ 1024
472 >        memTotal = memory& \ 1048576
473          memory& = memsts.dwAvailPhys
474 <        memFree = memory& \ 1024
474 >        memFree = memory& \ 1048576
475          memory& = memsts.dwTotalVirtual
476 <        swapTotal = memory& \ 1024
476 >        swapTotal = memory& \ 1048576
477          memory& = memsts.dwAvailVirtual
478 <        swapFree = memory& \ 1024
478 >        swapFree = memory& \ 1048576
479          
458        uptime = CUpTime.MilliSecs \ 1000
459        
480          CUpTime.Capture
481          cpu_time = CUpTime.CPUTime
482          percent_idle = CUpTime.PercentIdle
483          
484 +        '' Doesn't work after 47 days :-/
485 +        'uptime = GetTickCount \ 1000
486 +        
487 +        'secondsRunning = secondsRunning + UDPUpdateTime
488 +        'uptime = secondsRunning
489 +        
490 +        uptime = CUpTime.MilliSecs / 1000#
491 +        
492          userCount = wksta.LoggedOnUsers
493          
494          ' build the contents of the XML packet
495          xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & LocalIP & """>" & _
496                "<os>" & _
497 +                "<netbios_name>" & netbiosName & "</netbios_name>" & _
498                  "<name>" & osName & "</name>" & _
499 <                "<version>" & osVersionMajor & "</version>" & _
499 >                "<version>" & osVersionMajor & "." & osVersionMinor & "</version>" & _
500                  "<release>" & osBuild & "</release>" & _
501 <                "<platform>" & osName & "</platform>" & _
473 <                "<minor_version>" & osVersionMinor & "</minor_version>" & _
474 <                "<processor>" & processorType & "</processor>" & _
501 >                "<platform>" & processorType & "</platform>" & _
502                  "<uptime>" & uptime & "</uptime>" & _
503                "</os>" & _
504                "<users><count>" & userCount & "</count></users>" & _

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines