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

Comparing experimental/host/vb_net_test/nettest.frm (file contents):
Revision 1.1 by pjm2, Thu Feb 22 17:04:22 2001 UTC vs.
Revision 1.29 by pjm2, Wed Feb 28 10:45:37 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 filterHostname As String
143 + Dim filterTCPPort As Integer
144 + Dim filterUDPPort As Integer
145 + Dim fileList As String
146 + Dim lastModified As String
147 +
148 + Dim UDPUpdateTime As Integer
149 + Dim TCPUpdateTime As Integer
150 +
151 + Dim protocolVersion As String
152 + Dim connected As Boolean
153 +
154 + Dim CUpTime As New CUpTime
155 + Dim wksta As New CNetWksta
156 +
157 + Dim windowBig As Boolean
158 +
159 + Dim responseNumber As Integer
160 +
161   Private Sub Command1_Click()
162  
163 <    ' 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
163 >    ' Toggle visibility of the debug output.
164  
165 +    If windowBig Then
166 +        Form1.Height = 1500
167 +        windowBig = False
168 +    Else
169 +        Form1.Height = 4350
170 +        windowBig = True
171 +    End If
172 +
173   End Sub
174  
175 < Private Sub Command2_Click()
175 > Private Sub Form_Load()
176      
177 <    ' establish a TCP connection to a machine
178 <    Winsock2.Close
179 <    Winsock2.Connect Text3.Text, Text2.Text
177 >    If App.PrevInstance Then
178 >        x = MsgBox("There is already an i-scream Winhost running on this machine.", 48, "i-scream host already running")
179 >        End
180 >    End If
181 >    
182 >    protocolVersion = "1.1"
183 >    
184 >    Status.Caption = "Loading"
185 >    Form1.Caption = "i-scream Winhost " & protocolVersion
186 >    
187 >    CUpTime.Init
188 >    
189 >    If CUpTime.isWin9x Then
190 >        x = MsgBox("Sorry, the i-scream host can only be used to monitor servers (i.e. not Win9x)", 48, "Not a server")
191 >        End
192 >    End If
193 >    
194 >    windowBig = False
195 >    
196 >    ''''TEMP
197 >    'filterManagerHostname = "killigrew.ukc.ac.uk"
198 >    'filterManagerTCPPort = 4567
199 >    ''''' END TEMP
200 >    
201 >    'GoTo skip
202 >    On Error GoTo iniError
203 >    Dim buf As String * 256
204 >    Dim length As Long
205 >    length = GetPrivateProfileString("i-scream Winhost", "FilterManager", "<no value>", buf, Len(buf), App.Path & "/winhost.ini")
206 >    filterManagerHostname = Left$(buf, length)
207 >    length = GetPrivateProfileInt("i-scream Winhost", "FilterManagerPort", 0, App.Path & "/winhost.ini")
208 >    filterManagerTCPPort = length
209 >    If filterManagerHostname = "" Then
210 >        GoTo iniError
211 >    End If
212 >    On Error GoTo 0
213 > skip:
214  
215 +    Status.Caption = "Connecting to Filter Manager " & filterManagerHostname & ":" & filterManagerTCPPort
216 +    Reconfigure_Click
217 +    
218 +    SystemTray.Icon = Val(Form1.Icon)
219 +    SystemTray.Action = 0
220 +    
221 +    
222 +    Exit Sub
223 +    
224 + iniError:
225 +    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")
226 +    End
227 +    
228   End Sub
229  
230 < Private Sub Command3_Click()
231 <    x = MsgBox("not implemented..")
230 > Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
231 >    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")
232 >    If x = 7 Then
233 >        Cancel = True
234 >    Else
235 >        SystemTray.Action = 2
236 >    End If
237 >
238   End Sub
239  
240 < Private Sub Winsock2_Connect()
241 <      
242 <   responseNumber = 0
240 > Private Sub Hide_Click()
241 >    Form1.Visible = False
242 >    SystemTray.Icon = Val(Form1.Icon)
243 > End Sub
244 >
245 > Private Sub Reconfigure_Click()
246 >    ' establish a TCP connection to a filtermanager
247 >    connected = False
248 >    TCPSock.Close
249 >    TCPSock.Connect filterManagerHostname, filterManagerTCPPort
250 > End Sub
251 >
252 >
253 >
254 > Private Sub SystemTray_MouseDblClk(ByVal Button As Integer)
255 >
256 >    Form1.Visible = True
257 >    Form1.SetFocus
258 >
259 > End Sub
260 >
261 > Private Sub TCPSock_Connect()
262 >    
263 >    responseNumber = 0
264    
265 <   ' As soon as we are connected to the server, send this.
266 <   Winsock2.SendData "STARTCONFIG" & vbCrLf
265 >    ' Send something as soon as we connect to the server.
266 >    If connected = False Then
267 >        ' contact the FilterManager
268 >        TCPSock.SendData "STARTCONFIG" & vbCrLf
269 >    Else
270 >       ' Contact the Filter
271 >       TCPSock.SendData "HEARTBEAT" & vbCrLf
272 >    End If
273    
274   End Sub
275  
276 < Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
276 > Private Sub TCPSock_DataArrival(ByVal bytesTotal As Long)
277      
278      responseNumber = responseNumber + 1
279      
280      ' Get the line from the server.
281 <    Winsock2.GetData response, vbString, bytesTotal
281 >    TCPSock.GetData response, vbString, bytesTotal
282      
283      ' Remove linefeeds and returns from the line.
284      response = Replace(response, Chr(13), "")
285      response = Replace(response, Chr(10), "")
166    Text4.Text = Text4.Text & vbCrLf & response
286      
287 <    ' Decide what to send back to the server.
288 <    Select Case responseNumber
289 <        Case 1:
290 <            Winsock2.SendData "LASTMODIFIED" & vbCrLf
291 <        Case 2:
292 <            Winsock2.SendData "FILELIST" & vbCrLf
293 <        Case 3:
294 <            Winsock2.SendData "UDPUpdateTime" & vbCrLf
295 <        Case 4:
296 <            Winsock2.SendData "TCPUpdateTime" & vbCrLf
297 <        Case 5:
298 <            Winsock2.SendData "ENDCONFIG" & vbCrLf
299 <        Case 6:
300 <            Winsock2.SendData "FILTER" & vbCrLf
301 <        Case 7:
302 <            Winsock2.SendData "END" & vbCrLf
303 <        Case 8:
304 <            Winsock2.Close
305 <            Text4.Text = Text4.Text & vbCrLf & "  <closed>"
306 <    End Select
287 >    If connected = False Then
288 >        ' Perform TCP configuration (1.1)
289 >        On Error GoTo configError
290 >        Select Case responseNumber
291 >            Case 1:
292 >                If Not response = "OK" Then GoTo configError
293 >                TCPSock.SendData "LASTMODIFIED" & vbCrLf
294 >                Text1.Text = "Requesting configuration from FilterManager:- " & vbCrLf
295 >                Text1.Text = Text1.Text & response & vbCrLf
296 >            Case 2:
297 >                If response = "ERROR" Then GoTo configError
298 >                lastModified = response
299 >                Text1.Text = Text1.Text & response & vbCrLf
300 >                TCPSock.SendData "FILELIST" & 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 >                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 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 7:
323 >                If Not response = "OK" Then GoTo configError
324 >                Text1.Text = Text1.Text & response & vbCrLf
325 >                TCPSock.SendData "FILTER" & vbCrLf
326 >            Case 8:
327 >                Text1.Text = Text1.Text & response & vbCrLf
328 >                'we got a filter list here.
329 >                readTo = 0
330 >                ' get hostname
331 >                readTo = InStr(1, response, ";", vbBinaryCompare)
332 >                filterHostname = Mid(response, 1, readTo - 1)
333 >                response = Mid(response, readTo + 1, Len(response))
334 >                ' get UDP Port number
335 >                readTo = InStr(1, response, ";")
336 >                filterUDPPort = Mid(response, 1, readTo - 1)
337 >                response = Mid(response, readTo + 1, Len(response))
338 >                ' get TCP Port number
339 >                filterTCPPort = response
340 >                TCPSock.SendData "END" & vbCrLf
341 >            Case 9:
342 >                If Not response = "OK" Then GoTo configError
343 >                connected = True
344 >                responseNumber = 0
345 >                TCPSock.Close
346 >                Text1.Text = Text1.Text & response & vbCrLf
347 >                'Text4.Text = Text4.Text & vbCrLf & "  <closed>"
348 >                Status.Caption = "Configuration successful"
349 >                Label3.Caption = UDPUpdateTime
350 >                Label4.Caption = TCPUpdateTime
351 >                Timer1.Interval = 1000
352 >        End Select
353 >    Else
354 >        ' Perform a heartbeat (1.1)
355 >        On Error GoTo heartbeatError
356 >        Select Case responseNumber
357 >            Case 1:
358 >                If Not response = "OK" Then GoTo heartbeatError
359 >                Text1.Text = "Performing heartbeat: -" & vbCrLf
360 >                Text1.Text = Text1.Text & response & vbCrLf
361 >                TCPSock.SendData "CONFIG" & vbCrLf
362 >            Case 2:
363 >                If Not response = "OK" Then GoTo heartbeatError
364 >                Text1.Text = Text1.Text & response & vbCrLf
365 >                TCPSock.SendData fileList & vbCrLf
366 >            Case 3:
367 >                If Not response = "OK" Then GoTo heartbeatError
368 >                Text1.Text = Text1.Text & response & vbCrLf
369 >                TCPSock.SendData lastModified & vbCrLf
370 >            Case 4:
371 >                If Not response = "OK" Then GoTo heartbeatError
372 >                Text1.Text = Text1.Text & response & vbCrLf
373 >                TCPSock.SendData "ENDHEARTBEAT" & vbCrLf
374 >            Case 5:
375 >                If Not response = "OK" Then GoTo heartbeatError
376 >                Text1.Text = Text1.Text & response & vbCrLf
377 >                TCPSock.Close
378 >                Status.Caption = "Heartbeat sent successfully."
379 >        End Select
380      
381 +    End If
382 +    
383 +    
384 +    Exit Sub
385 +    
386 + configError:
387 +    Status.Caption = "FAILED to get configuration"
388 +    Exit Sub
389 + heartbeatError:
390 +    Status.Caption = "Heatbeat FAILED"
391 +    Exit Sub
392   End Sub
393 +
394 + Private Sub Timer1_Timer()
395 +
396 +    Label3.Caption = Label3.Caption - 1
397 +    Label4.Caption = Label4.Caption - 1
398 +    
399 +    Status.Caption = ""
400 +    
401 +    If Label3.Caption < 1 Then
402 +        
403 +        ' prepare the contents of the XML packet.
404 +        seqNo = seqNo + 1
405 +        
406 +        ' Comment this line in the next protocol
407 +        'machineName = TCPSock.LocalHostName
408 +        
409 +        LocalIP = TCPSock.LocalIP
410 +        packetDate = Date2Num()
411 +        
412 +        
413 +        Dim verinfo As OSVERSIONINFO
414 +        verinfo.dwOSVersionInfoSize = Len(verinfo)
415 +        ret% = GetVersionEx(verinfo)
416 +        If ret% = 0 Then
417 +            MsgBox "Error getting Windows version Information"
418 +            End
419 +        End If
420 +          
421 +        osName = GetVersion()
422 +        osVersionMajor = verinfo.dwMajorVersion
423 +        osVersionMinor = verinfo.dwMinorVersion
424 +        osBuild = verinfo.dwBuildNumber
425 +        
426 +        Dim sysinfo As SYSTEM_INFO
427 +        GetSystemInfo sysinfo
428 +        Select Case sysinfo.dwProcessorType
429 +            Case PROCESSOR_INTEL_386
430 +                processorType = "Intel 386"
431 +            Case PROCESSOR_INTEL_486
432 +                processorType = "Intel 486"
433 +            Case PROCESSOR_INTEL_PENTIUM
434 +                processorType = "Intel Pentium variant"
435 +            Case PROCESSOR_MIPS_R4000
436 +                processorType = "MIPS R4000"
437 +            Case PROCESSOR_ALPHA_21064
438 +                processorType = "DEC Alpha 21064"
439 +            Case Else
440 +                processorType = "(unknown)"
441 +        End Select
442 +        
443 +        Dim memsts As MEMORYSTATUS
444 +        Dim memory&
445 +        GlobalMemoryStatus memsts
446 +        memory& = memsts.dwTotalPhys
447 +        memTotal = memory& \ 1048576
448 +        memory& = memsts.dwAvailPhys
449 +        memFree = memory& \ 1048576
450 +        memory& = memsts.dwTotalVirtual
451 +        swapTotal = memory& \ 1048576
452 +        memory& = memsts.dwAvailVirtual
453 +        swapFree = memory& \ 1048576
454 +        
455 +        uptime = CUpTime.MilliSecs \ 1000
456 +        
457 +        CUpTime.Capture
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>" & _
466 +                "<name>" & osName & "</name>" & _
467 +                "<version>" & osVersionMajor & "</version>" & _
468 +                "<release>" & osBuild & "</release>" & _
469 +                "<platform>" & osName & "</platform>" & _
470 +                "<minor_version>" & osVersionMinor & "</minor_version>" & _
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>" & _
478 +              "</packet>"
479 +        Text1.Text = "Last packet contained: -" & vbCrLf & xml
480 +
481 +        ' Use the first winsock control to send a UDP packet.
482 +        UDPSock.RemoteHost = filterHostname
483 +        UDPSock.RemotePort = filterUDPPort
484 +        UDPSock.SendData xml
485 +        Status.Caption = "UDP packet sent"
486 +        Label3.Caption = UDPUpdateTime
487 +    End If
488 +    
489 +    If Label4.Caption < 1 Then
490 +        ' establish a TCP connection to a filter
491 +        TCPSock.Close
492 +        TCPSock.Connect filterHostname, filterTCPPort
493 +        Label4.Caption = TCPUpdateTime
494 +    End If
495 +
496 + End Sub
497 +
498 + Function Date2Num() As Long
499 +    Dim x As Long
500 +    x = DateDiff("s", "1-1-1970", Now)
501 +    Date2Num = x
502 + End Function

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines