ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/host/vb_net_test/nettest.frm
(Generate patch)

Comparing experimental/host/vb_net_test/nettest.frm (file contents):
Revision 1.5 by pjm2, Fri Feb 23 10:34:47 2001 UTC vs.
Revision 1.8 by pjm2, Fri Feb 23 11:25:35 2001 UTC

# Line 14 | Line 14 | Begin VB.Form Form1
14     ScaleWidth      =   5670
15     ShowInTaskbar   =   0   'False
16     StartUpPosition =   3  'Windows Default
17 +   Begin VB.Timer Timer1
18 +      Left            =   3840
19 +      Top             =   120
20 +   End
21     Begin VB.CommandButton Command3
22        Caption         =   "TCP to Filter"
23        Height          =   375
24        Left            =   3720
25 <      TabIndex        =   5
25 >      TabIndex        =   3
26        Top             =   2520
27        Width           =   1575
28     End
29     Begin VB.TextBox Text4
30 <      Height          =   2535
30 >      Height          =   1575
31        Left            =   240
32        MultiLine       =   -1  'True
33        ScrollBars      =   2  'Vertical
34 <      TabIndex        =   4
34 >      TabIndex        =   2
35        Text            =   "nettest.frx":0000
36        Top             =   3000
37        Width           =   5055
# Line 36 | Line 40 | Begin VB.Form Form1
40        Caption         =   "TCP to FilterManager"
41        Height          =   375
42        Left            =   3360
43 <      TabIndex        =   3
43 >      TabIndex        =   1
44        Top             =   2040
45        Width           =   1935
46     End
# Line 51 | Line 55 | Begin VB.Form Form1
55        Caption         =   "Send UDP"
56        Height          =   375
57        Left            =   4320
58 <      TabIndex        =   2
58 >      TabIndex        =   0
59        Top             =   1560
60        Width           =   975
61     End
58   Begin VB.TextBox Text1
59      Height          =   855
60      Left            =   360
61      TabIndex        =   0
62      Text            =   "<packet></packet>"
63      Top             =   600
64      Width           =   4935
65   End
62     Begin MSWinsockLib.Winsock UDPSock
63        Left            =   4320
64        Top             =   120
# Line 71 | Line 67 | Begin VB.Form Form1
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
86 +   Begin VB.Label Label2
87 +      Caption         =   "Label2"
88 +      Height          =   255
89 +      Left            =   120
90 +      TabIndex        =   6
91 +      Top             =   600
92 +      Width           =   3375
93 +   End
94     Begin VB.Label Label1
95 <      Caption         =   "Packet contents"
95 >      Caption         =   "Label1"
96        Height          =   255
97 <      Left            =   360
98 <      TabIndex        =   1
99 <      Top             =   360
100 <      Width           =   2895
97 >      Left            =   120
98 >      TabIndex        =   5
99 >      Top             =   240
100 >      Width           =   3375
101     End
102 +   Begin VB.Label Status
103 +      Caption         =   "Status:"
104 +      Height          =   255
105 +      Left            =   120
106 +      TabIndex        =   4
107 +      Top             =   5280
108 +      Width           =   5415
109 +   End
110   End
111   Attribute VB_Name = "Form1"
112   Attribute VB_GlobalNameSpace = False
# Line 97 | Line 125 | Dim filterUDPPort As Integer
125   Dim fileList As String
126   Dim lastModified As String
127  
128 + Dim UDPUpdateTime As Integer
129 + Dim TCPUpdateTime As Integer
130 +
131   Dim protocolVersion As String
132   Dim connected As Boolean
133   Dim responseNumber As Integer
# Line 111 | Line 142 | Private Sub Command1_Click()
142      UDPSock.RemoteHost = filterHostname
143      UDPSock.RemotePort = filterUDPPort
144      UDPSock.SendData xml
145 +    Status.Caption = "i-scream Winhost " & protocolVersion & " - UDP packet sent."
146  
147   End Sub
148  
# Line 131 | Line 163 | End Sub
163   Private Sub Form_Load()
164      protocolVersion = "1.1"
165      
166 +    Status.Caption = "i-scream Winhost " & protocolVersion
167 +    
168      ''''TEMP
169      filterManagerHostname = "killigrew.ukc.ac.uk"
170      filterManagerTCPPort = 4567
# Line 145 | Line 179 | Private Sub Form_Load()
179      length = GetPrivateProfileString("i-scream Winhost", "FilterManagerPort", "<no value>", buf, Len(buf), App.Path & "winhost.ini")
180      filterManagerTCPPort = Left$(buf, length)
181      
182 +    Status.Caption = "i-scream Winhost " & protocolVersion & " connecting to Filter Manager"
183 +    
184      Exit Sub
185      
186   iniError:
# Line 154 | Line 190 | iniError:
190   End Sub
191  
192   Private Sub TCPSock_Connect()
193 <      
194 <   responseNumber = 0
193 >    
194 >    responseNumber = 0
195    
196      ' Send something as soon as we connect to the server.
197      If connected = False Then
# Line 197 | Line 233 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
233                  TCPSock.SendData "UDPUpdateTime" & vbCrLf
234              Case 4:
235                  If response = "ERROR" Then GoTo configError
236 +                UDPUpdateTime = response
237                  TCPSock.SendData "TCPUpdateTime" & vbCrLf
238              Case 5:
239                  If response = "ERROR" Then GoTo configError
240 +                TCPUpdateTime = response
241                  TCPSock.SendData "ENDCONFIG" & vbCrLf
242              Case 6:
243                  If Not response = "OK" Then GoTo configError
# Line 224 | Line 262 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
262                  responseNumber = 0
263                  TCPSock.Close
264                  Text4.Text = Text4.Text & vbCrLf & "  <closed>"
265 <                x = MsgBox("got config okay")
265 >                Label1.Caption = "TCP hearbeat interval: " & UDPUpdateTime
266 >                Label2.Caption = "UDP packet interval: " & TCPUpdateTime
267 >                Status.Caption = "i-scream Winhost " & protocolVersion & " - got config okay"
268 >                Label3.Caption = UDPUpdateTime
269 >                Label4.Caption = TCPUpdateTime
270 >                Timer1.Interval = 1000
271          End Select
272      Else
273          ' Perform a heartbeat (1.1)
# Line 245 | Line 288 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
288              Case 5:
289                  If Not response = "OK" Then GoTo heartbeatError
290                  TCPSock.Close
291 <                x = MsgBox("heartbeat sent okay.")
291 >                Status.Caption = "i-scream Winhost " & protocolVersion & " - heartbeat sent okay."
292          End Select
293      
294      End If
# Line 254 | Line 297 | Private Sub TCPSock_DataArrival(ByVal bytesTotal As Lo
297      Exit Sub
298      
299   configError:
300 <    x = MsgBox("error doing configuration")
300 >    Status.Caption = "i-scream Winhost " & protocolVersion & " - FAILED to get configuration " & Err.Description
301 >    Exit Sub
302   heartbeatError:
303 <    x = MsgBox("error doing configuration")
303 >    Status.Caption = "i-scream Winhost " & protocolVersion & " - Heatbeat FAILED " & Err.Description
304 >    Exit Sub
305   End Sub
306  
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 +
328 + Private Sub Timer1_Timer()
329 +
330 +    Label3.Caption = Label3.Caption - 1
331 +    Label4.Caption = Label4.Caption - 1
332 +    
333 +    Status.Caption = "i-scream Winhost " & protocolVersion
334 +    
335 +    If Label3.Caption < 1 Then
336 +        ' build the contents of the XML packet.
337 +        xml = "<packet></packet>"
338 +
339 +        ' Use the first winsock control to send a UDP packet.
340 +        UDPSock.RemoteHost = filterHostname
341 +        UDPSock.RemotePort = filterUDPPort
342 +        UDPSock.SendData xml
343 +        Status.Caption = "i-scream Winhost " & protocolVersion & " - UDP packet sent."
344 +        Label3.Caption = UDPUpdateTime
345 +    End If
346 +    
347 +    If Label4.Caption < 1 Then
348 +        ' establish a TCP connection to a filter
349 +        TCPSock.Close
350 +        TCPSock.Connect filterHostname, filterTCPPort
351 +        Label4.Caption = TCPUpdateTime
352 +    End If
353 +
354 + End Sub

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines