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 |
|
|
140 |
– |
|
141 |
– |
Private Sub Command1_Click() |
142 |
– |
|
143 |
– |
' build the contents of the XML packet. |
144 |
– |
xml = "<packet></packet>" |
145 |
– |
|
146 |
– |
' Use the first winsock control to send a UDP packet. |
147 |
– |
UDPSock.RemoteHost = filterHostname |
148 |
– |
UDPSock.RemotePort = filterUDPPort |
149 |
– |
UDPSock.SendData xml |
150 |
– |
Status.Caption = "i-scream Winhost " & protocolVersion & " - UDP packet sent." |
151 |
– |
|
152 |
– |
End Sub |
153 |
– |
|
154 |
– |
|
155 |
– |
Private Sub Command3_Click() |
156 |
– |
' establish a TCP connection to a filter |
157 |
– |
TCPSock.Close |
158 |
– |
TCPSock.Connect filterHostname, filterTCPPort |
159 |
– |
End Sub |
160 |
– |
|
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 |
171 |
< |
Exit Sub |
172 |
< |
''' 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 |
|
|
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 |