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.1 by pjm2, Thu Feb 22 17:04:22 2001 UTC vs.
Revision 1.33 by pjm2, Wed Mar 14 10:47:26 2001 UTC

# Line 1 | Line 1
1   VERSION 5.00
2   Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
3 + Object = "{33155A3D-0CE0-11D1-A6B4-444553540000}#1.0#0"; "SysTray.ocx"
4   Begin VB.Form Form1
5     BorderStyle     =   3  'Fixed Dialog
6 <   Caption         =   "TCP/UDP Test program"
7 <   ClientHeight    =   5655
6 >   Caption         =   "i-scream Winhost"
7 >   ClientHeight    =   1185
8     ClientLeft      =   45
9     ClientTop       =   330
10 <   ClientWidth     =   5670
10 >   ClientWidth     =   4710
11 >   Icon            =   "nettest.frx":0000
12     LinkTopic       =   "Form1"
13     MaxButton       =   0   'False
14     MinButton       =   0   'False
15 <   ScaleHeight     =   5655
16 <   ScaleWidth      =   5670
15 >   ScaleHeight     =   1185
16 >   ScaleWidth      =   4710
17     ShowInTaskbar   =   0   'False
18 <   StartUpPosition =   3  'Windows Default
19 <   Begin VB.CommandButton Command3
20 <      Caption         =   "TCP to Filter"
21 <      Height          =   375
22 <      Left            =   3720
23 <      TabIndex        =   9
24 <      Top             =   2520
25 <      Width           =   1575
18 >   StartUpPosition =   2  'CenterScreen
19 >   Visible         =   0   'False
20 >   Begin VB.CommandButton Command1
21 >      Caption         =   "more"
22 >      Height          =   255
23 >      Left            =   3960
24 >      TabIndex        =   8
25 >      Top             =   840
26 >      Width           =   615
27     End
28 <   Begin VB.TextBox Text4
29 <      Height          =   2535
30 <      Left            =   240
28 >   Begin VB.TextBox Text1
29 >      Height          =   2055
30 >      Left            =   120
31 >      Locked          =   -1  'True
32        MultiLine       =   -1  'True
33        ScrollBars      =   2  'Vertical
30      TabIndex        =   8
31      Text            =   "nettest.frx":0000
32      Top             =   3000
33      Width           =   5055
34   End
35   Begin VB.CommandButton Command2
36      Caption         =   "TCP to FilterManager"
37      Height          =   375
38      Left            =   3360
34        TabIndex        =   7
35 <      Top             =   2040
36 <      Width           =   1935
35 >      Top             =   1200
36 >      Width           =   4455
37     End
38 <   Begin MSWinsockLib.Winsock Winsock2
39 <      Left            =   4920
40 <      Top             =   120
41 <      _ExtentX        =   741
42 <      _ExtentY        =   741
43 <      _Version        =   393216
38 >   Begin VB.CommandButton Hide
39 >      Caption         =   "hide"
40 >      Height          =   255
41 >      Left            =   3960
42 >      TabIndex        =   6
43 >      Top             =   480
44 >      Width           =   615
45     End
46 <   Begin VB.TextBox Text3
47 <      Height          =   285
48 <      Left            =   1680
49 <      TabIndex        =   5
50 <      Text            =   "killigrew.ukc.ac.uk"
51 <      Top             =   1560
52 <      Width           =   2535
46 >   Begin SysTray.SystemTray SystemTray
47 >      Left            =   2520
48 >      Top             =   4200
49 >      _ExtentX        =   847
50 >      _ExtentY        =   847
51 >      SysTrayText     =   "i-scream Winhost"
52 >      IconFile        =   0
53     End
54 <   Begin VB.TextBox Text2
55 <      Height          =   285
56 <      Left            =   1680
61 <      TabIndex        =   3
62 <      Text            =   "4567"
63 <      Top             =   1920
64 <      Width           =   855
54 >   Begin VB.Timer Timer1
55 >      Left            =   3120
56 >      Top             =   4200
57     End
58 <   Begin VB.CommandButton Command1
59 <      Caption         =   "Send UDP"
58 >   Begin VB.CommandButton Reconfigure
59 >      Caption         =   "Reconfigure with FilterManager"
60        Height          =   375
61 <      Left            =   4320
70 <      TabIndex        =   2
71 <      Top             =   1560
72 <      Width           =   975
73 <   End
74 <   Begin VB.TextBox Text1
75 <      Height          =   855
76 <      Left            =   360
61 >      Left            =   840
62        TabIndex        =   0
63 <      Text            =   "<packet></packet>"
64 <      Top             =   600
80 <      Width           =   4935
63 >      Top             =   3480
64 >      Width           =   2895
65     End
66 <   Begin MSWinsockLib.Winsock Winsock1
67 <      Left            =   4320
68 <      Top             =   120
66 >   Begin MSWinsockLib.Winsock TCPSock
67 >      Left            =   4080
68 >      Top             =   4200
69        _ExtentX        =   741
70        _ExtentY        =   741
71        _Version        =   393216
72 +   End
73 +   Begin MSWinsockLib.Winsock UDPSock
74 +      Left            =   3600
75 +      Top             =   4200
76 +      _ExtentX        =   741
77 +      _ExtentY        =   741
78 +      _Version        =   393216
79        Protocol        =   1
80     End
81 <   Begin VB.Label Label3
81 >   Begin VB.Label Label2
82        Alignment       =   1  'Right Justify
83 <      Caption         =   "Destination:"
83 >      Caption         =   "Next heartbeat:"
84        Height          =   255
85 <      Left            =   360
86 <      TabIndex        =   6
87 <      Top             =   1560
88 <      Width           =   1215
85 >      Left            =   120
86 >      TabIndex        =   5
87 >      Top             =   480
88 >      Width           =   1455
89     End
90 <   Begin VB.Label Label2
90 >   Begin VB.Label Label1
91        Alignment       =   1  'Right Justify
92 <      Caption         =   "Port:"
92 >      Caption         =   "Next UDP packet:"
93        Height          =   255
94 <      Left            =   360
94 >      Left            =   120
95        TabIndex        =   4
96 <      Top             =   1920
97 <      Width           =   1215
96 >      Top             =   120
97 >      Width           =   1455
98     End
99 <   Begin VB.Label Label1
100 <      Caption         =   "Packet contents"
99 >   Begin VB.Label Label4
100 >      BorderStyle     =   1  'Fixed Single
101 >      Caption         =   "0"
102        Height          =   255
103 <      Left            =   360
103 >      Left            =   1680
104 >      TabIndex        =   3
105 >      Top             =   480
106 >      Width           =   615
107 >   End
108 >   Begin VB.Label Label3
109 >      BorderStyle     =   1  'Fixed Single
110 >      Caption         =   "0"
111 >      Height          =   255
112 >      Left            =   1680
113 >      TabIndex        =   2
114 >      Top             =   120
115 >      Width           =   615
116 >   End
117 >   Begin VB.Label Status
118 >      Alignment       =   2  'Center
119 >      Caption         =   "Status:"
120 >      Height          =   255
121 >      Left            =   0
122        TabIndex        =   1
123 <      Top             =   360
124 <      Width           =   2895
123 >      Top             =   840
124 >      Width           =   3855
125     End
126   End
127   Attribute VB_Name = "Form1"
# Line 119 | Line 129 | Attribute VB_GlobalNameSpace = False
129   Attribute VB_Creatable = False
130   Attribute VB_PredeclaredId = True
131   Attribute VB_Exposed = False
132 < Dim responseNumber As Integer
132 > ' For the system tray bits
133 > Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
134 > Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
135  
136 + Dim filterManagerHostname As String
137 + Dim filterManagerTCPPort As Long
138  
139 + Dim seqNo As Long
140 + Dim machineName As String
141 +
142 + Dim secondsRunning As Long
143 +
144 + Dim filterHostname As String
145 + Dim filterTCPPort As Integer
146 + Dim filterUDPPort As Integer
147 + Dim fileList As String
148 + Dim lastModified As String
149 +
150 + Dim fourtySevenDays As Integer
151 +
152 + Dim UDPUpdateTime As Integer
153 + Dim TCPUpdateTime As Integer
154 +
155 + Dim protocolVersion As String
156 + Dim connected As Boolean
157 +
158 + Dim CUpTime As New CUpTime
159 + Dim wksta As New CNetWksta
160 +
161 + Dim windowBig As Boolean
162 +
163 + Dim responseNumber As Integer
164 +
165   Private Sub Command1_Click()
166  
167 <    ' Use the first winsock control to send
128 <    ' a UDP packet.
129 <    Winsock1.RemoteHost = Text3.Text
130 <    Winsock1.RemotePort = Text2.Text
131 <    Winsock1.SendData Text1.Text
167 >    ' Toggle visibility of the debug output.
168  
169 +    If windowBig Then
170 +        Form1.Height = 1500
171 +        windowBig = False
172 +    Else
173 +        Form1.Height = 4350
174 +        windowBig = True
175 +    End If
176 +
177   End Sub
178  
179 < Private Sub Command2_Click()
179 > Private Sub Form_Load()
180      
181 <    ' establish a TCP connection to a machine
182 <    Winsock2.Close
183 <    Winsock2.Connect Text3.Text, Text2.Text
181 >    If App.PrevInstance Then
182 >        x = MsgBox("There is already an i-scream Winhost running on this machine.", 48, "i-scream host already running")
183 >        End
184 >    End If
185 >    
186 >    ' Assume the host is run within the first 47 days of the machine starting.
187 >    fourtySevenDays = 0
188 >    
189 >    protocolVersion = "1.1"
190 >    
191 >    Status.Caption = "Loading"
192 >    Form1.Caption = "i-scream Winhost " & protocolVersion
193 >    
194 >    CUpTime.Init
195 >    
196 >    If CUpTime.isWin9x Then
197 >        x = MsgBox("Sorry, the i-scream host can only be used to monitor servers (i.e. not Win9x)", 48, "Not a server")
198 >        End
199 >    End If
200 >    
201 >    windowBig = False
202 >    
203 >    ''''TEMP
204 >    'filterManagerHostname = "killigrew.ukc.ac.uk"
205 >    'filterManagerTCPPort = 4567
206 >    ''''' END TEMP
207 >    
208 >    'GoTo skip
209 >    On Error GoTo iniError
210 >    Dim buf As String * 256
211 >    Dim length As Long
212 >    length = GetPrivateProfileString("i-scream Winhost", "FilterManager", "<no value>", buf, Len(buf), App.Path & "/winhost.ini")
213 >    filterManagerHostname = Left$(buf, length)
214 >    length = GetPrivateProfileInt("i-scream Winhost", "FilterManagerPort", 0, App.Path & "/winhost.ini")
215 >    filterManagerTCPPort = length
216 >    If filterManagerHostname = "" Then
217 >        GoTo iniError
218 >    End If
219 >    On Error GoTo 0
220 > skip:
221  
222 +    Status.Caption = "Connecting to Filter Manager " & filterManagerHostname & ":" & filterManagerTCPPort
223 +    Reconfigure_Click
224 +    
225 +    SystemTray.Icon = Val(Form1.Icon)
226 +    SystemTray.Action = 0
227 +    
228 +    
229 +    Exit Sub
230 +    
231 + iniError:
232 +    x = MsgBox("The i-scream Winhost could not read the correct settings from the winhost.ini file.  Please correct these and try again.  " & Err.Description, 48, "Configuration not found")
233 +    End
234 +    
235   End Sub
236  
237 < Private Sub Command3_Click()
238 <    x = MsgBox("not implemented..")
237 > Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
238 >    x = MsgBox("Are you sure you want to shut down the Winhost?  This will stop your computer sending information to the i-scream Central Monitoring System.", vbYesNo, "i-scream Winhost")
239 >    If x = 7 Then
240 >        Cancel = True
241 >    Else
242 >        SystemTray.Action = 2
243 >    End If
244 >
245   End Sub
246  
247 < Private Sub Winsock2_Connect()
248 <      
249 <   responseNumber = 0
247 > Private Sub Hide_Click()
248 >    Form1.Visible = False
249 >    SystemTray.Icon = Val(Form1.Icon)
250 > End Sub
251 >
252 > Private Sub Image1_Click()
253 >
254 > End Sub
255 >
256 > Private Sub Reconfigure_Click()
257 >    ' establish a TCP connection to a filtermanager
258 >    connected = False
259 >    TCPSock.Close
260 >    TCPSock.Connect filterManagerHostname, filterManagerTCPPort
261 > End Sub
262 >
263 >
264 >
265 > Private Sub SystemTray_MouseDblClk(ByVal Button As Integer)
266 >
267 >    Form1.Visible = True
268 >    Form1.SetFocus
269 >
270 > End Sub
271 >
272 > Private Sub TCPSock_Connect()
273 >    
274 >    responseNumber = 0
275    
276 <   ' As soon as we are connected to the server, send this.
277 <   Winsock2.SendData "STARTCONFIG" & vbCrLf
276 >    ' Send something as soon as we connect to the server.
277 >    If connected = False Then
278 >        ' contact the FilterManager
279 >        TCPSock.SendData "STARTCONFIG" & vbCrLf
280 >    Else
281 >       ' Contact the Filter
282 >       TCPSock.SendData "HEARTBEAT" & vbCrLf
283 >    End If
284    
285   End Sub
286  
287 < Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
287 > Private Sub TCPSock_DataArrival(ByVal bytesTotal As Long)
288      
289      responseNumber = responseNumber + 1
290      
291      ' Get the line from the server.
292 <    Winsock2.GetData response, vbString, bytesTotal
292 >    TCPSock.GetData response, vbString, bytesTotal
293      
294      ' Remove linefeeds and returns from the line.
295      response = Replace(response, Chr(13), "")
296      response = Replace(response, Chr(10), "")
166    Text4.Text = Text4.Text & vbCrLf & response
297      
298 <    ' Decide what to send back to the server.
299 <    Select Case responseNumber
300 <        Case 1:
301 <            Winsock2.SendData "LASTMODIFIED" & vbCrLf
302 <        Case 2:
303 <            Winsock2.SendData "FILELIST" & vbCrLf
304 <        Case 3:
305 <            Winsock2.SendData "UDPUpdateTime" & vbCrLf
306 <        Case 4:
307 <            Winsock2.SendData "TCPUpdateTime" & vbCrLf
308 <        Case 5:
309 <            Winsock2.SendData "ENDCONFIG" & vbCrLf
310 <        Case 6:
311 <            Winsock2.SendData "FILTER" & vbCrLf
312 <        Case 7:
313 <            Winsock2.SendData "END" & vbCrLf
314 <        Case 8:
315 <            Winsock2.Close
316 <            Text4.Text = Text4.Text & vbCrLf & "  <closed>"
317 <    End Select
298 >    If connected = False Then
299 >        ' Perform TCP configuration (1.1)
300 >        On Error GoTo configError
301 >        Select Case responseNumber
302 >            Case 1:
303 >                If Not response = "OK" Then GoTo configError
304 >                TCPSock.SendData "LASTMODIFIED" & vbCrLf
305 >                Text1.Text = "Requesting configuration from FilterManager:- " & vbCrLf
306 >                Text1.Text = Text1.Text & response & vbCrLf
307 >            Case 2:
308 >                If response = "ERROR" Then GoTo configError
309 >                lastModified = response
310 >                Text1.Text = Text1.Text & response & vbCrLf
311 >                TCPSock.SendData "FILELIST" & vbCrLf
312 >            ' New addition to the protocol.
313 >            Case 3:
314 >                If response = "ERROR" Then GoTo configError
315 >                fileList = response
316 >                Text1.Text = Text1.Text & response & vbCrLf
317 >                TCPSock.SendData "FQDN" & vbCrLf
318 >            Case 4:
319 >                If response = "ERROR" Then GoTo configError
320 >                Text1.Text = Text1.Text & response & vbCrLf
321 >                machineName = response
322 >                TCPSock.SendData "UDPUpdateTime" & vbCrLf
323 >            Case 5:
324 >                If response = "ERROR" Then GoTo configError
325 >                UDPUpdateTime = response
326 >                Text1.Text = Text1.Text & response & vbCrLf
327 >                TCPSock.SendData "TCPUpdateTime" & vbCrLf
328 >            Case 6:
329 >                If response = "ERROR" Then GoTo configError
330 >                TCPUpdateTime = response
331 >                Text1.Text = Text1.Text & response & vbCrLf
332 >                TCPSock.SendData "ENDCONFIG" & vbCrLf
333 >            Case 7:
334 >                If Not response = "OK" Then GoTo configError
335 >                Text1.Text = Text1.Text & response & vbCrLf
336 >                TCPSock.SendData "FILTER" & vbCrLf
337 >            Case 8:
338 >                Text1.Text = Text1.Text & response & vbCrLf
339 >                'we got a filter list here.
340 >                readTo = 0
341 >                ' get hostname
342 >                readTo = InStr(1, response, ";", vbBinaryCompare)
343 >                filterHostname = Mid(response, 1, readTo - 1)
344 >                response = Mid(response, readTo + 1, Len(response))
345 >                ' get UDP Port number
346 >                readTo = InStr(1, response, ";")
347 >                filterUDPPort = Mid(response, 1, readTo - 1)
348 >                response = Mid(response, readTo + 1, Len(response))
349 >                ' get TCP Port number
350 >                filterTCPPort = response
351 >                TCPSock.SendData "END" & vbCrLf
352 >            Case 9:
353 >                If Not response = "OK" Then GoTo configError
354 >                connected = True
355 >                responseNumber = 0
356 >                TCPSock.Close
357 >                Text1.Text = Text1.Text & response & vbCrLf
358 >                'Text4.Text = Text4.Text & vbCrLf & "  <closed>"
359 >                Status.Caption = "Configuration successful"
360 >                Label3.Caption = UDPUpdateTime
361 >                Label4.Caption = TCPUpdateTime
362 >                Timer1.Interval = 1000
363 >        End Select
364 >    Else
365 >        ' Perform a heartbeat (1.1)
366 >        On Error GoTo heartbeatError
367 >        Select Case responseNumber
368 >            Case 1:
369 >                If Not response = "OK" Then GoTo heartbeatError
370 >                Text1.Text = "Performing heartbeat: -" & vbCrLf
371 >                Text1.Text = Text1.Text & response & vbCrLf
372 >                TCPSock.SendData "CONFIG" & vbCrLf
373 >            Case 2:
374 >                If Not response = "OK" Then GoTo heartbeatError
375 >                Text1.Text = Text1.Text & response & vbCrLf
376 >                TCPSock.SendData fileList & vbCrLf
377 >            Case 3:
378 >                If Not response = "OK" Then GoTo heartbeatError
379 >                Text1.Text = Text1.Text & response & vbCrLf
380 >                TCPSock.SendData lastModified & vbCrLf
381 >            Case 4:
382 >                If Not response = "OK" Then GoTo heartbeatError
383 >                Text1.Text = Text1.Text & response & vbCrLf
384 >                TCPSock.SendData "ENDHEARTBEAT" & vbCrLf
385 >            Case 5:
386 >                If Not response = "OK" Then GoTo heartbeatError
387 >                Text1.Text = Text1.Text & response & vbCrLf
388 >                TCPSock.Close
389 >                Status.Caption = "Heartbeat sent successfully."
390 >        End Select
391      
392 +    End If
393 +    
394 +    
395 +    Exit Sub
396 +    
397 + configError:
398 +    Status.Caption = "FAILED to get configuration from the server"
399 +    Exit Sub
400 + heartbeatError:
401 +    Status.Caption = "Heatbeat FAILED"
402 +    Exit Sub
403   End Sub
404 +
405 + Private Sub Timer1_Timer()
406 +
407 +    Label3.Caption = Label3.Caption - 1
408 +    Label4.Caption = Label4.Caption - 1
409 +    
410 +    Status.Caption = ""
411 +    
412 +    If Label3.Caption < 1 Then
413 +        
414 +        ' prepare the contents of the XML packet.
415 +        seqNo = seqNo + 1
416 +        
417 +        netbiosName = TCPSock.LocalHostName
418 +        
419 +        LocalIP = TCPSock.LocalIP
420 +        packetDate = Date2Num()
421 +        
422 +        
423 +        Dim verinfo As OSVERSIONINFO
424 +        verinfo.dwOSVersionInfoSize = Len(verinfo)
425 +        ret% = GetVersionEx(verinfo)
426 +        If ret% = 0 Then
427 +            MsgBox "Error getting Windows version Information"
428 +            End
429 +        End If
430 +          
431 +        osName = GetVersion()
432 +        osVersionMajor = verinfo.dwMajorVersion
433 +        osVersionMinor = verinfo.dwMinorVersion
434 +        osBuild = verinfo.dwBuildNumber
435 +        
436 +        Dim sysinfo As SYSTEM_INFO
437 +        GetSystemInfo sysinfo
438 +        Select Case sysinfo.dwProcessorType
439 +            Case PROCESSOR_INTEL_386
440 +                processorType = "Intel 386"
441 +            Case PROCESSOR_INTEL_486
442 +                processorType = "Intel 486"
443 +            Case PROCESSOR_INTEL_PENTIUM
444 +                processorType = "Intel Pentium variant"
445 +            Case PROCESSOR_MIPS_R4000
446 +                processorType = "MIPS R4000"
447 +            Case PROCESSOR_ALPHA_21064
448 +                processorType = "DEC Alpha 21064"
449 +            Case Else
450 +                processorType = "(unknown)"
451 +        End Select
452 +        
453 +        Dim memsts As MEMORYSTATUS
454 +        Dim memory&
455 +        GlobalMemoryStatus memsts
456 +        memory& = memsts.dwTotalPhys
457 +        memTotal = memory& \ 1048576
458 +        memory& = memsts.dwAvailPhys
459 +        memFree = memory& \ 1048576
460 +        memory& = memsts.dwTotalVirtual
461 +        swapTotal = memory& \ 1048576
462 +        memory& = memsts.dwAvailVirtual
463 +        swapFree = memory& \ 1048576
464 +        
465 +        CUpTime.Capture
466 +        cpu_time = CUpTime.CPUTime
467 +        percent_idle = CUpTime.PercentIdle
468 +        
469 +        '' Doesn't work after 47 days :-/
470 +        'uptime = GetTickCount \ 1000
471 +        
472 +        'secondsRunning = secondsRunning + UDPUpdateTime
473 +        'uptime = secondsRunning
474 +        
475 +        uptime = CUpTime.MilliSecs / 1000#
476 +        
477 +        userCount = wksta.LoggedOnUsers
478 +        
479 +        ' build the contents of the XML packet
480 +        xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & LocalIP & """>" & _
481 +              "<os>" & _
482 +                "<netbios_name>" & netbiosName & "</netbios_name>" & _
483 +                "<name>" & osName & "</name>" & _
484 +                "<version>" & osVersionMajor & "</version>" & _
485 +                "<release>" & osBuild & "</release>" & _
486 +                "<platform>" & osName & "</platform>" & _
487 +                "<minor_version>" & osVersionMinor & "</minor_version>" & _
488 +                "<processor>" & processorType & "</processor>" & _
489 +                "<uptime>" & uptime & "</uptime>" & _
490 +              "</os>" & _
491 +              "<users><count>" & userCount & "</count></users>" & _
492 +              "<cpu><idle>" & percent_idle & "</idle><user>" & cpu_time & "</user></cpu>" & _
493 +              "<memory><total>" & memTotal & "</total><free>" & memFree & "</free></memory>" & _
494 +              "<swap><total>" & swapTotal & "</total><free>" & swapFree & "</free></swap>" & _
495 +              "</packet>"
496 +        Text1.Text = "Last packet contained: -" & vbCrLf & xml
497 +
498 +        ' Use the first winsock control to send a UDP packet.
499 +        UDPSock.RemoteHost = filterHostname
500 +        UDPSock.RemotePort = filterUDPPort
501 +        UDPSock.SendData xml
502 +        Status.Caption = "UDP packet sent"
503 +        Label3.Caption = UDPUpdateTime
504 +    End If
505 +    
506 +    If Label4.Caption < 1 Then
507 +        ' establish a TCP connection to a filter
508 +        TCPSock.Close
509 +        TCPSock.Connect filterHostname, filterTCPPort
510 +        Label4.Caption = TCPUpdateTime
511 +    End If
512 +
513 + End Sub
514 +
515 + Function Date2Num() As Long
516 +    Dim x As Long
517 +    x = DateDiff("s", "1-1-1970", Now)
518 +    Date2Num = x
519 + End Function

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines