7 |
|
ClientHeight = 5655 |
8 |
|
ClientLeft = 45 |
9 |
|
ClientTop = 285 |
10 |
< |
ClientWidth = 5670 |
10 |
> |
ClientWidth = 4710 |
11 |
|
LinkTopic = "Form1" |
12 |
|
MaxButton = 0 'False |
13 |
|
ScaleHeight = 5655 |
14 |
< |
ScaleWidth = 5670 |
14 |
> |
ScaleWidth = 4710 |
15 |
|
ShowInTaskbar = 0 'False |
16 |
|
StartUpPosition = 3 'Windows Default |
17 |
|
Begin VB.CommandButton Hide |
18 |
< |
Caption = "Hide" |
19 |
< |
Height = 495 |
20 |
< |
Left = 1800 |
18 |
> |
Caption = "Hide Window" |
19 |
> |
Height = 375 |
20 |
> |
Left = 3120 |
21 |
|
TabIndex = 7 |
22 |
< |
Top = 2160 |
23 |
< |
Width = 1215 |
22 |
> |
Top = 840 |
23 |
> |
Width = 1455 |
24 |
|
End |
25 |
|
Begin SysTray.SystemTray SystemTray |
26 |
< |
Left = 3600 |
27 |
< |
Top = 1200 |
26 |
> |
Left = 2160 |
27 |
> |
Top = 1800 |
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 |
34 |
> |
Left = 2760 |
35 |
> |
Top = 1800 |
36 |
|
End |
37 |
|
Begin VB.TextBox Text4 |
38 |
|
Height = 1575 |
42 |
|
TabIndex = 1 |
43 |
|
Text = "nettest.frx":0000 |
44 |
|
Top = 3000 |
45 |
< |
Width = 5055 |
45 |
> |
Width = 3975 |
46 |
|
End |
47 |
|
Begin VB.CommandButton Reconfigure |
48 |
|
Caption = "Reconfigure with FilterManager" |
49 |
< |
Height = 495 |
49 |
> |
Height = 375 |
50 |
|
Left = 120 |
51 |
|
TabIndex = 0 |
52 |
< |
Top = 120 |
52 |
> |
Top = 840 |
53 |
|
Width = 2895 |
54 |
|
End |
55 |
|
Begin MSWinsockLib.Winsock TCPSock |
56 |
< |
Left = 5160 |
57 |
< |
Top = 1200 |
56 |
> |
Left = 3720 |
57 |
> |
Top = 1800 |
58 |
|
_ExtentX = 741 |
59 |
|
_ExtentY = 741 |
60 |
|
_Version = 393216 |
61 |
|
End |
62 |
|
Begin MSWinsockLib.Winsock UDPSock |
63 |
< |
Left = 4680 |
64 |
< |
Top = 1200 |
63 |
> |
Left = 3240 |
64 |
> |
Top = 1800 |
65 |
|
_ExtentX = 741 |
66 |
|
_ExtentY = 741 |
67 |
|
_Version = 393216 |
71 |
|
Alignment = 1 'Right Justify |
72 |
|
Caption = "Next heartbeat:" |
73 |
|
Height = 255 |
74 |
< |
Left = 3360 |
74 |
> |
Left = 2400 |
75 |
|
TabIndex = 6 |
76 |
|
Top = 480 |
77 |
|
Width = 1455 |
80 |
|
Alignment = 1 'Right Justify |
81 |
|
Caption = "Next UDP packet:" |
82 |
|
Height = 255 |
83 |
< |
Left = 3360 |
83 |
> |
Left = 2400 |
84 |
|
TabIndex = 5 |
85 |
|
Top = 120 |
86 |
|
Width = 1455 |
89 |
|
BorderStyle = 1 'Fixed Single |
90 |
|
Caption = "0" |
91 |
|
Height = 255 |
92 |
< |
Left = 4920 |
92 |
> |
Left = 3960 |
93 |
|
TabIndex = 4 |
94 |
|
Top = 480 |
95 |
|
Width = 615 |
98 |
|
BorderStyle = 1 'Fixed Single |
99 |
|
Caption = "0" |
100 |
|
Height = 255 |
101 |
< |
Left = 4920 |
101 |
> |
Left = 3960 |
102 |
|
TabIndex = 3 |
103 |
|
Top = 120 |
104 |
|
Width = 615 |
105 |
|
End |
106 |
|
Begin VB.Label Status |
107 |
+ |
Alignment = 2 'Center |
108 |
|
Caption = "Status:" |
109 |
|
Height = 255 |
110 |
|
Left = 120 |
111 |
|
TabIndex = 2 |
112 |
< |
Top = 840 |
113 |
< |
Width = 5415 |
112 |
> |
Top = 1320 |
113 |
> |
Width = 4455 |
114 |
|
End |
115 |
|
End |
116 |
|
Attribute VB_Name = "Form1" |
124 |
|
Dim filterManagerHostname As String |
125 |
|
Dim filterManagerTCPPort As Integer |
126 |
|
|
127 |
+ |
Dim seqNo As Long |
128 |
+ |
Dim machineName As String |
129 |
+ |
|
130 |
|
Dim filterHostname As String |
131 |
|
Dim filterTCPPort As Integer |
132 |
|
Dim filterUDPPort As Integer |
140 |
|
Dim connected As Boolean |
141 |
|
Dim responseNumber As Integer |
142 |
|
|
139 |
– |
|
140 |
– |
Private Sub Command1_Click() |
141 |
– |
|
142 |
– |
' build the contents of the XML packet. |
143 |
– |
xml = "<packet></packet>" |
144 |
– |
|
145 |
– |
' Use the first winsock control to send a UDP packet. |
146 |
– |
UDPSock.RemoteHost = filterHostname |
147 |
– |
UDPSock.RemotePort = filterUDPPort |
148 |
– |
UDPSock.SendData xml |
149 |
– |
Status.Caption = "i-scream Winhost " & protocolVersion & " - UDP packet sent." |
150 |
– |
|
151 |
– |
End Sub |
152 |
– |
|
153 |
– |
|
154 |
– |
Private Sub Command3_Click() |
155 |
– |
' establish a TCP connection to a filter |
156 |
– |
TCPSock.Close |
157 |
– |
TCPSock.Connect filterHostname, filterTCPPort |
158 |
– |
End Sub |
159 |
– |
|
143 |
|
Private Sub Form_Load() |
144 |
+ |
|
145 |
|
protocolVersion = "1.1" |
146 |
< |
|
146 |
> |
|
147 |
|
Status.Caption = "Loading" |
148 |
|
Form1.Caption = "i-scream Winhost " & protocolVersion |
149 |
|
|
150 |
|
''''TEMP |
151 |
|
filterManagerHostname = "killigrew.ukc.ac.uk" |
152 |
|
filterManagerTCPPort = 4567 |
153 |
< |
Reconfigure_Click |
170 |
< |
Exit Sub |
171 |
< |
''' ENDTEMP |
153 |
> |
''''' END TEMP |
154 |
|
|
155 |
+ |
GoTo skip |
156 |
|
On Error GoTo iniError |
157 |
|
Dim buf As String * 256 |
158 |
|
Dim length As Long |
160 |
|
filterManagerHostname = Left$(buf, length) |
161 |
|
length = GetPrivateProfileString("i-scream Winhost", "FilterManagerPort", "<no value>", buf, Len(buf), App.Path & "winhost.ini") |
162 |
|
filterManagerTCPPort = Left$(buf, length) |
163 |
< |
|
163 |
> |
skip: |
164 |
> |
|
165 |
|
Status.Caption = "Connecting to Filter Manager" |
166 |
+ |
Reconfigure_Click |
167 |
|
|
168 |
|
Exit Sub |
169 |
|
|
178 |
|
If x = 7 Then |
179 |
|
Cancel = True |
180 |
|
End If |
181 |
+ |
SystemTray.Action = 2 |
182 |
|
|
183 |
|
End Sub |
184 |
|
|
200 |
|
Private Sub SystemTray_MouseDblClk(ByVal Button As Integer) |
201 |
|
|
202 |
|
Form1.Visible = True |
203 |
+ |
SystemTray.Action = 2 |
204 |
|
Form1.SetFocus |
205 |
+ |
|
206 |
|
|
207 |
|
End Sub |
208 |
|
|
328 |
|
|
329 |
|
If Label3.Caption < 1 Then |
330 |
|
' build the contents of the XML packet. |
331 |
< |
xml = "<packet></packet>" |
331 |
> |
localIP = TCPSock.localIP |
332 |
> |
machineName = TCPSock.LocalHostName |
333 |
> |
seqNo = seqNo + 1 |
334 |
> |
packetDate = Date2Num() |
335 |
> |
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & localIP & """>" & _ |
336 |
> |
"" & _ |
337 |
> |
"" & _ |
338 |
> |
"" & _ |
339 |
> |
"" & _ |
340 |
> |
"" & _ |
341 |
> |
"" & _ |
342 |
> |
"" & _ |
343 |
> |
"" & _ |
344 |
> |
"" & _ |
345 |
> |
"" & _ |
346 |
> |
"" & _ |
347 |
> |
"" & _ |
348 |
> |
"" & _ |
349 |
> |
"" & _ |
350 |
> |
"" |
351 |
> |
Text4.Text = Text4.Text + xml |
352 |
|
|
353 |
|
' Use the first winsock control to send a UDP packet. |
354 |
|
UDPSock.RemoteHost = filterHostname |
366 |
|
End If |
367 |
|
|
368 |
|
End Sub |
369 |
+ |
|
370 |
+ |
Function Date2Num() As Long |
371 |
+ |
Dim x As Long |
372 |
+ |
x = DateDiff("s", "1-1-1970", Now) |
373 |
+ |
Date2Num = x |
374 |
+ |
End Function |