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 |
+ |
x = MsgBox(Date2Num()) |
145 |
+ |
|
146 |
|
protocolVersion = "1.1" |
147 |
< |
|
147 |
> |
|
148 |
|
Status.Caption = "Loading" |
149 |
|
Form1.Caption = "i-scream Winhost " & protocolVersion |
150 |
|
|
151 |
|
''''TEMP |
152 |
|
filterManagerHostname = "killigrew.ukc.ac.uk" |
153 |
|
filterManagerTCPPort = 4567 |
154 |
< |
Reconfigure_Click |
171 |
< |
Exit Sub |
172 |
< |
''' ENDTEMP |
154 |
> |
''''' END TEMP |
155 |
|
|
156 |
+ |
GoTo skip |
157 |
|
On Error GoTo iniError |
158 |
|
Dim buf As String * 256 |
159 |
|
Dim length As Long |
161 |
|
filterManagerHostname = Left$(buf, length) |
162 |
|
length = GetPrivateProfileString("i-scream Winhost", "FilterManagerPort", "<no value>", buf, Len(buf), App.Path & "winhost.ini") |
163 |
|
filterManagerTCPPort = Left$(buf, length) |
164 |
< |
|
164 |
> |
skip: |
165 |
> |
|
166 |
|
Status.Caption = "Connecting to Filter Manager" |
167 |
+ |
Reconfigure_Click |
168 |
|
|
169 |
|
Exit Sub |
170 |
|
|
329 |
|
|
330 |
|
If Label3.Caption < 1 Then |
331 |
|
' build the contents of the XML packet. |
332 |
< |
xml = "<packet></packet>" |
332 |
> |
localIP = TCPSock.localIP |
333 |
> |
machineName = TCPSock.LocalHostName |
334 |
> |
seqNo = seqNo + 1 |
335 |
> |
packetDate = Now() |
336 |
> |
xml = "<packet seq_no=""" & seqNo & """ machine_name=""" & machineName & """ date=""" & packetDate & """ type=""data"" ip=""" & localIP & """>" & _ |
337 |
> |
"" & _ |
338 |
> |
"" & _ |
339 |
> |
"" & _ |
340 |
> |
"" & _ |
341 |
> |
"" & _ |
342 |
> |
"" & _ |
343 |
> |
"" & _ |
344 |
> |
"" & _ |
345 |
> |
"" & _ |
346 |
> |
"" & _ |
347 |
> |
"" & _ |
348 |
> |
"" & _ |
349 |
> |
"" & _ |
350 |
> |
"" & _ |
351 |
> |
"" |
352 |
> |
Text4.Text = Text4.Text + xml |
353 |
|
|
354 |
|
' Use the first winsock control to send a UDP packet. |
355 |
|
UDPSock.RemoteHost = filterHostname |
367 |
|
End If |
368 |
|
|
369 |
|
End Sub |
370 |
+ |
|
371 |
+ |
Function Date2Num() As Long |
372 |
+ |
Date2Num = DateDiff("s", "1-1-1970", Now) |
373 |
+ |
End Function |