120 |
|
Attribute VB_PredeclaredId = True |
121 |
|
Attribute VB_Exposed = False |
122 |
|
Dim filterHostname As String |
123 |
< |
Dim filterTCPPort As String |
124 |
< |
Dim filterUDPPort As String |
123 |
> |
Dim filterTCPPort As Integer |
124 |
> |
Dim filterUDPPort As Integer |
125 |
> |
Dim fileList As String |
126 |
> |
Dim lastModified As String |
127 |
|
|
128 |
|
Dim protocolVersion As String |
129 |
|
Dim connected As Boolean |
141 |
|
|
142 |
|
Private Sub Command2_Click() |
143 |
|
|
144 |
< |
' establish a TCP connection to a machine |
144 |
> |
' establish a TCP connection to a filtermanager |
145 |
|
Winsock2.Close |
146 |
|
Winsock2.Connect Text3.Text, Text2.Text |
147 |
|
|
148 |
|
End Sub |
149 |
|
|
150 |
|
Private Sub Command3_Click() |
151 |
< |
x = MsgBox("not implemented..") |
151 |
> |
' establish a TCP connection to a filter |
152 |
> |
Winsock2.Close |
153 |
> |
Winsock2.Connect filterHostname, filterTCPPort |
154 |
|
End Sub |
155 |
|
|
156 |
|
Private Sub Form_Load() |
161 |
|
|
162 |
|
responseNumber = 0 |
163 |
|
|
164 |
< |
' As soon as we are connected to the server, send this. |
165 |
< |
Winsock2.SendData "STARTCONFIG" & vbCrLf |
164 |
> |
' Send something as soon as we connect to the server. |
165 |
> |
If connected = False Then |
166 |
> |
' contact the FilterManager |
167 |
> |
Winsock2.SendData "STARTCONFIG" & vbCrLf |
168 |
> |
Else |
169 |
> |
' Contact the Filter |
170 |
> |
Winsock2.SendData "HEARTBEAT" & vbCrLf |
171 |
> |
End If |
172 |
|
|
173 |
|
End Sub |
174 |
|
|
193 |
|
Winsock2.SendData "LASTMODIFIED" & vbCrLf |
194 |
|
Case 2: |
195 |
|
If response = "ERROR" Then GoTo configError |
196 |
+ |
lastModified = response |
197 |
|
Winsock2.SendData "FILELIST" & vbCrLf |
198 |
|
Case 3: |
199 |
|
If response = "ERROR" Then GoTo configError |
200 |
+ |
fileList = response |
201 |
|
Winsock2.SendData "UDPUpdateTime" & vbCrLf |
202 |
|
Case 4: |
203 |
|
If response = "ERROR" Then GoTo configError |
235 |
|
On Error GoTo heartbeatError |
236 |
|
Select Case responseNumber |
237 |
|
Case 1: |
238 |
< |
|
238 |
> |
If Not response = "OK" Then GoTo heartbeatError |
239 |
> |
Winsock2.SendData "CONFIG" & vbCrLf |
240 |
|
Case 2: |
241 |
< |
|
241 |
> |
If Not response = "OK" Then GoTo heartbeatError |
242 |
> |
Winsock2.SendData fileList & vbCrLf |
243 |
|
Case 3: |
244 |
< |
|
244 |
> |
If Not response = "OK" Then GoTo heartbeatError |
245 |
> |
Winsock2.SendData lastModified & vbCrLf |
246 |
|
Case 4: |
247 |
< |
|
247 |
> |
If Not response = "OK" Then GoTo heartbeatError |
248 |
> |
Winsock2.SendData "ENDHEARTBEAT" & vbCrLf |
249 |
|
Case 5: |
250 |
< |
|
251 |
< |
Case 6: |
252 |
< |
|
237 |
< |
Case 7: |
238 |
< |
|
239 |
< |
Case 8: |
240 |
< |
|
250 |
> |
If Not response = "OK" Then GoTo heartbeatError |
251 |
> |
Winsock2.Close |
252 |
> |
x = MsgBox("heartbeat sent okay.") |
253 |
|
End Select |
254 |
|
|
255 |
|
End If |