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" |
5 |
> |
BorderStyle = 4 'Fixed ToolWindow |
6 |
> |
Caption = "i-scream Winhost" |
7 |
|
ClientHeight = 5655 |
8 |
|
ClientLeft = 45 |
9 |
< |
ClientTop = 330 |
9 |
> |
ClientTop = 285 |
10 |
|
ClientWidth = 5670 |
11 |
|
LinkTopic = "Form1" |
12 |
|
MaxButton = 0 'False |
12 |
– |
MinButton = 0 'False |
13 |
|
ScaleHeight = 5655 |
14 |
|
ScaleWidth = 5670 |
15 |
|
ShowInTaskbar = 0 'False |
16 |
|
StartUpPosition = 3 'Windows Default |
17 |
< |
Begin VB.Timer Timer1 |
18 |
< |
Left = 3840 |
19 |
< |
Top = 120 |
17 |
> |
Begin VB.CommandButton Hide |
18 |
> |
Caption = "Hide" |
19 |
> |
Height = 495 |
20 |
> |
Left = 1800 |
21 |
> |
TabIndex = 7 |
22 |
> |
Top = 2160 |
23 |
> |
Width = 1215 |
24 |
|
End |
25 |
< |
Begin VB.CommandButton Command3 |
26 |
< |
Caption = "TCP to Filter" |
27 |
< |
Height = 375 |
28 |
< |
Left = 3720 |
29 |
< |
TabIndex = 3 |
30 |
< |
Top = 2520 |
31 |
< |
Width = 1575 |
25 |
> |
Begin SysTray.SystemTray SystemTray |
26 |
> |
Left = 3600 |
27 |
> |
Top = 1200 |
28 |
> |
_ExtentX = 847 |
29 |
> |
_ExtentY = 847 |
30 |
> |
SysTrayText = "i-scream Winhost" |
31 |
> |
IconFile = 0 |
32 |
|
End |
33 |
+ |
Begin VB.Timer Timer1 |
34 |
+ |
Left = 4200 |
35 |
+ |
Top = 1200 |
36 |
+ |
End |
37 |
|
Begin VB.TextBox Text4 |
38 |
|
Height = 1575 |
39 |
|
Left = 240 |
40 |
|
MultiLine = -1 'True |
41 |
|
ScrollBars = 2 'Vertical |
42 |
< |
TabIndex = 2 |
42 |
> |
TabIndex = 1 |
43 |
|
Text = "nettest.frx":0000 |
44 |
|
Top = 3000 |
45 |
|
Width = 5055 |
46 |
|
End |
47 |
< |
Begin VB.CommandButton Command2 |
48 |
< |
Caption = "TCP to FilterManager" |
49 |
< |
Height = 375 |
50 |
< |
Left = 3360 |
51 |
< |
TabIndex = 1 |
52 |
< |
Top = 2040 |
53 |
< |
Width = 1935 |
47 |
> |
Begin VB.CommandButton Reconfigure |
48 |
> |
Caption = "Reconfigure with FilterManager" |
49 |
> |
Height = 495 |
50 |
> |
Left = 120 |
51 |
> |
TabIndex = 0 |
52 |
> |
Top = 120 |
53 |
> |
Width = 2895 |
54 |
|
End |
55 |
|
Begin MSWinsockLib.Winsock TCPSock |
56 |
< |
Left = 4920 |
57 |
< |
Top = 120 |
56 |
> |
Left = 5160 |
57 |
> |
Top = 1200 |
58 |
|
_ExtentX = 741 |
59 |
|
_ExtentY = 741 |
60 |
|
_Version = 393216 |
61 |
|
End |
54 |
– |
Begin VB.CommandButton Command1 |
55 |
– |
Caption = "Send UDP" |
56 |
– |
Height = 375 |
57 |
– |
Left = 4320 |
58 |
– |
TabIndex = 0 |
59 |
– |
Top = 1560 |
60 |
– |
Width = 975 |
61 |
– |
End |
62 |
|
Begin MSWinsockLib.Winsock UDPSock |
63 |
< |
Left = 4320 |
64 |
< |
Top = 120 |
63 |
> |
Left = 4680 |
64 |
> |
Top = 1200 |
65 |
|
_ExtentX = 741 |
66 |
|
_ExtentY = 741 |
67 |
|
_Version = 393216 |
68 |
|
Protocol = 1 |
69 |
|
End |
70 |
– |
Begin VB.Label Label4 |
71 |
– |
Caption = "Label4" |
72 |
– |
Height = 255 |
73 |
– |
Left = 1920 |
74 |
– |
TabIndex = 8 |
75 |
– |
Top = 1320 |
76 |
– |
Width = 615 |
77 |
– |
End |
78 |
– |
Begin VB.Label Label3 |
79 |
– |
Caption = "Label3" |
80 |
– |
Height = 255 |
81 |
– |
Left = 1920 |
82 |
– |
TabIndex = 7 |
83 |
– |
Top = 960 |
84 |
– |
Width = 615 |
85 |
– |
End |
70 |
|
Begin VB.Label Label2 |
71 |
< |
Caption = "Label2" |
71 |
> |
Alignment = 1 'Right Justify |
72 |
> |
Caption = "Next heartbeat:" |
73 |
|
Height = 255 |
74 |
< |
Left = 120 |
74 |
> |
Left = 3360 |
75 |
|
TabIndex = 6 |
76 |
< |
Top = 600 |
77 |
< |
Width = 3375 |
76 |
> |
Top = 480 |
77 |
> |
Width = 1455 |
78 |
|
End |
79 |
|
Begin VB.Label Label1 |
80 |
< |
Caption = "Label1" |
80 |
> |
Alignment = 1 'Right Justify |
81 |
> |
Caption = "Next UDP packet:" |
82 |
|
Height = 255 |
83 |
< |
Left = 120 |
83 |
> |
Left = 3360 |
84 |
|
TabIndex = 5 |
85 |
< |
Top = 240 |
86 |
< |
Width = 3375 |
85 |
> |
Top = 120 |
86 |
> |
Width = 1455 |
87 |
|
End |
88 |
+ |
Begin VB.Label Label4 |
89 |
+ |
BorderStyle = 1 'Fixed Single |
90 |
+ |
Caption = "0" |
91 |
+ |
Height = 255 |
92 |
+ |
Left = 4920 |
93 |
+ |
TabIndex = 4 |
94 |
+ |
Top = 480 |
95 |
+ |
Width = 615 |
96 |
+ |
End |
97 |
+ |
Begin VB.Label Label3 |
98 |
+ |
BorderStyle = 1 'Fixed Single |
99 |
+ |
Caption = "0" |
100 |
+ |
Height = 255 |
101 |
+ |
Left = 4920 |
102 |
+ |
TabIndex = 3 |
103 |
+ |
Top = 120 |
104 |
+ |
Width = 615 |
105 |
+ |
End |
106 |
|
Begin VB.Label Status |
107 |
|
Caption = "Status:" |
108 |
|
Height = 255 |
109 |
|
Left = 120 |
110 |
< |
TabIndex = 4 |
111 |
< |
Top = 5280 |
110 |
> |
TabIndex = 2 |
111 |
> |
Top = 840 |
112 |
|
Width = 5415 |
113 |
|
End |
114 |
|
End |
150 |
|
|
151 |
|
End Sub |
152 |
|
|
149 |
– |
Private Sub Command2_Click() |
150 |
– |
|
151 |
– |
' establish a TCP connection to a filtermanager |
152 |
– |
TCPSock.Close |
153 |
– |
TCPSock.Connect filterManagerHostname, filterManagerTCPPort |
153 |
|
|
155 |
– |
End Sub |
156 |
– |
|
154 |
|
Private Sub Command3_Click() |
155 |
|
' establish a TCP connection to a filter |
156 |
|
TCPSock.Close |
159 |
|
|
160 |
|
Private Sub Form_Load() |
161 |
|
protocolVersion = "1.1" |
162 |
+ |
|
163 |
+ |
Status.Caption = "Loading" |
164 |
+ |
Form1.Caption = "i-scream Winhost " & protocolVersion |
165 |
|
|
166 |
– |
Status.Caption = "i-scream Winhost " & protocolVersion |
167 |
– |
|
166 |
|
''''TEMP |
167 |
|
filterManagerHostname = "killigrew.ukc.ac.uk" |
168 |
|
filterManagerTCPPort = 4567 |
169 |
+ |
Reconfigure_Click |
170 |
|
Exit Sub |
171 |
|
''' ENDTEMP |
172 |
|
|
178 |
|
length = GetPrivateProfileString("i-scream Winhost", "FilterManagerPort", "<no value>", buf, Len(buf), App.Path & "winhost.ini") |
179 |
|
filterManagerTCPPort = Left$(buf, length) |
180 |
|
|
181 |
< |
Status.Caption = "i-scream Winhost " & protocolVersion & " connecting to Filter Manager" |
181 |
> |
Status.Caption = "Connecting to Filter Manager" |
182 |
|
|
183 |
|
Exit Sub |
184 |
|
|
188 |
|
|
189 |
|
End Sub |
190 |
|
|
191 |
+ |
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) |
192 |
+ |
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") |
193 |
+ |
If x = 7 Then |
194 |
+ |
Cancel = True |
195 |
+ |
End If |
196 |
+ |
|
197 |
+ |
End Sub |
198 |
+ |
|
199 |
+ |
Private Sub Hide_Click() |
200 |
+ |
Form1.Visible = False |
201 |
+ |
SystemTray.Icon = Val(Form1.Icon) |
202 |
+ |
SystemTray.Action = 0 |
203 |
+ |
End Sub |
204 |
+ |
|
205 |
+ |
Private Sub Reconfigure_Click() |
206 |
+ |
' establish a TCP connection to a filtermanager |
207 |
+ |
connected = False |
208 |
+ |
TCPSock.Close |
209 |
+ |
TCPSock.Connect filterManagerHostname, filterManagerTCPPort |
210 |
+ |
End Sub |
211 |
+ |
|
212 |
+ |
|
213 |
+ |
|
214 |
+ |
Private Sub SystemTray_MouseDblClk(ByVal Button As Integer) |
215 |
+ |
|
216 |
+ |
Form1.Visible = True |
217 |
+ |
Form1.SetFocus |
218 |
+ |
|
219 |
+ |
End Sub |
220 |
+ |
|
221 |
|
Private Sub TCPSock_Connect() |
222 |
|
|
223 |
|
responseNumber = 0 |
291 |
|
responseNumber = 0 |
292 |
|
TCPSock.Close |
293 |
|
Text4.Text = Text4.Text & vbCrLf & " <closed>" |
294 |
< |
Label1.Caption = "TCP hearbeat interval: " & UDPUpdateTime |
266 |
< |
Label2.Caption = "UDP packet interval: " & TCPUpdateTime |
267 |
< |
Status.Caption = "i-scream Winhost " & protocolVersion & " - got config okay" |
294 |
> |
Status.Caption = "Configuration successful" |
295 |
|
Label3.Caption = UDPUpdateTime |
296 |
|
Label4.Caption = TCPUpdateTime |
297 |
|
Timer1.Interval = 1000 |
315 |
|
Case 5: |
316 |
|
If Not response = "OK" Then GoTo heartbeatError |
317 |
|
TCPSock.Close |
318 |
< |
Status.Caption = "i-scream Winhost " & protocolVersion & " - heartbeat sent okay." |
318 |
> |
Status.Caption = "Heartbeat sent successfully." |
319 |
|
End Select |
320 |
|
|
321 |
|
End If |
324 |
|
Exit Sub |
325 |
|
|
326 |
|
configError: |
327 |
< |
Status.Caption = "i-scream Winhost " & protocolVersion & " - FAILED to get configuration " & Err.Description |
327 |
> |
Status.Caption = "FAILED to get configuration" |
328 |
|
Exit Sub |
329 |
|
heartbeatError: |
330 |
< |
Status.Caption = "i-scream Winhost " & protocolVersion & " - Heatbeat FAILED " & Err.Description |
330 |
> |
Status.Caption = "Heatbeat FAILED" |
331 |
|
Exit Sub |
332 |
|
End Sub |
333 |
|
|
307 |
– |
Private Sub TCPTimer_Timer() |
308 |
– |
|
309 |
– |
' establish a TCP connection to a filter |
310 |
– |
TCPSock.Close |
311 |
– |
TCPSock.Connect filterHostname, filterTCPPort |
312 |
– |
|
313 |
– |
End Sub |
314 |
– |
|
315 |
– |
Private Sub UDPTimer_Timer() |
316 |
– |
|
317 |
– |
' build the contents of the XML packet. |
318 |
– |
xml = "<packet></packet>" |
319 |
– |
|
320 |
– |
' Use the first winsock control to send a UDP packet. |
321 |
– |
UDPSock.RemoteHost = filterHostname |
322 |
– |
UDPSock.RemotePort = filterUDPPort |
323 |
– |
UDPSock.SendData xml |
324 |
– |
Status.Caption = "i-scream Winhost " & protocolVersion & " - UDP packet sent." |
325 |
– |
|
326 |
– |
End Sub |
327 |
– |
|
334 |
|
Private Sub Timer1_Timer() |
335 |
|
|
336 |
|
Label3.Caption = Label3.Caption - 1 |
337 |
|
Label4.Caption = Label4.Caption - 1 |
338 |
|
|
339 |
< |
Status.Caption = "i-scream Winhost " & protocolVersion |
339 |
> |
Status.Caption = "" |
340 |
|
|
341 |
|
If Label3.Caption < 1 Then |
342 |
|
' build the contents of the XML packet. |
346 |
|
UDPSock.RemoteHost = filterHostname |
347 |
|
UDPSock.RemotePort = filterUDPPort |
348 |
|
UDPSock.SendData xml |
349 |
< |
Status.Caption = "i-scream Winhost " & protocolVersion & " - UDP packet sent." |
349 |
> |
Status.Caption = "UDP packet sent" |
350 |
|
Label3.Caption = UDPUpdateTime |
351 |
|
End If |
352 |
|
|