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.4 by pjm2, Fri Feb 23 10:29:16 2001 UTC vs.
Revision 1.6 by pjm2, Fri Feb 23 10:53:30 2001 UTC

# Line 18 | Line 18 | Begin VB.Form Form1
18        Caption         =   "TCP to Filter"
19        Height          =   375
20        Left            =   3720
21 <      TabIndex        =   5
21 >      TabIndex        =   3
22        Top             =   2520
23        Width           =   1575
24     End
25     Begin VB.TextBox Text4
26 <      Height          =   2535
26 >      Height          =   1575
27        Left            =   240
28        MultiLine       =   -1  'True
29        ScrollBars      =   2  'Vertical
30 <      TabIndex        =   4
30 >      TabIndex        =   2
31        Text            =   "nettest.frx":0000
32        Top             =   3000
33        Width           =   5055
# Line 36 | Line 36 | Begin VB.Form Form1
36        Caption         =   "TCP to FilterManager"
37        Height          =   375
38        Left            =   3360
39 <      TabIndex        =   3
39 >      TabIndex        =   1
40        Top             =   2040
41        Width           =   1935
42     End
43 <   Begin MSWinsockLib.Winsock Winsock2
43 >   Begin MSWinsockLib.Winsock TCPSock
44        Left            =   4920
45        Top             =   120
46        _ExtentX        =   741
# Line 51 | Line 51 | Begin VB.Form Form1
51        Caption         =   "Send UDP"
52        Height          =   375
53        Left            =   4320
54 <      TabIndex        =   2
54 >      TabIndex        =   0
55        Top             =   1560
56        Width           =   975
57     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
66 <   Begin MSWinsockLib.Winsock Winsock1
58 >   Begin MSWinsockLib.Winsock UDPSock
59        Left            =   4320
60        Top             =   120
61        _ExtentX        =   741
# Line 71 | Line 63 | Begin VB.Form Form1
63        _Version        =   393216
64        Protocol        =   1
65     End
66 <   Begin VB.Label Label1
67 <      Caption         =   "Packet contents"
66 >   Begin VB.Label Status
67 >      Caption         =   "Status:"
68        Height          =   255
69 <      Left            =   360
70 <      TabIndex        =   1
71 <      Top             =   360
72 <      Width           =   2895
69 >      Left            =   120
70 >      TabIndex        =   4
71 >      Top             =   5280
72 >      Width           =   5415
73     End
74   End
75   Attribute VB_Name = "Form1"
# Line 104 | Line 96 | Dim responseNumber As Integer
96  
97   Private Sub Command1_Click()
98  
99 +    ' build the contents of the XML packet.
100      xml = "<packet></packet>"
101  
102      ' Use the first winsock control to send a UDP packet.
103 <    Winsock1.RemoteHost = filterHostname
104 <    Winsock1.RemotePort = filterUDPPort
105 <    Winsock1.SendData xml
103 >    UDPSock.RemoteHost = filterHostname
104 >    UDPSock.RemotePort = filterUDPPort
105 >    UDPSock.SendData xml
106 >    Status.Caption = "i-scream Winhost " & protocolVersion & " - UDP packet sent."
107  
108   End Sub
109  
110   Private Sub Command2_Click()
111      
112      ' establish a TCP connection to a filtermanager
113 <    Winsock2.Close
114 <    Winsock2.Connect filterManagerHostname, filterManagerTCPPort
113 >    TCPSock.Close
114 >    TCPSock.Connect filterManagerHostname, filterManagerTCPPort
115  
116   End Sub
117  
118   Private Sub Command3_Click()
119      ' establish a TCP connection to a filter
120 <    Winsock2.Close
121 <    Winsock2.Connect filterHostname, filterTCPPort
120 >    TCPSock.Close
121 >    TCPSock.Connect filterHostname, filterTCPPort
122   End Sub
123  
124   Private Sub Form_Load()
125      protocolVersion = "1.1"
126      
127 +    Status.Caption = "i-scream Winhost " & protocolVersion
128 +    
129      ''''TEMP
130      filterManagerHostname = "killigrew.ukc.ac.uk"
131      filterManagerTCPPort = 4567
# Line 144 | Line 140 | Private Sub Form_Load()
140      length = GetPrivateProfileString("i-scream Winhost", "FilterManagerPort", "<no value>", buf, Len(buf), App.Path & "winhost.ini")
141      filterManagerTCPPort = Left$(buf, length)
142      
143 +    Status.Caption = "i-scream Winhost " & protocolVersion & " connecting to Filter Manager"
144 +    
145      Exit Sub
146      
147   iniError:
# Line 152 | Line 150 | iniError:
150      
151   End Sub
152  
153 < Private Sub Label2_Click()
153 > Private Sub Label1_Click()
154  
155   End Sub
156  
157 < Private Sub Winsock2_Connect()
158 <      
159 <   responseNumber = 0
157 > Private Sub TCPSock_Connect()
158 >    
159 >    responseNumber = 0
160    
161      ' Send something as soon as we connect to the server.
162      If connected = False Then
163          ' contact the FilterManager
164 <        Winsock2.SendData "STARTCONFIG" & vbCrLf
164 >        TCPSock.SendData "STARTCONFIG" & vbCrLf
165      Else
166         ' Contact the Filter
167 <       Winsock2.SendData "HEARTBEAT" & vbCrLf
167 >       TCPSock.SendData "HEARTBEAT" & vbCrLf
168      End If
169    
170   End Sub
171  
172 < Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
172 > Private Sub TCPSock_DataArrival(ByVal bytesTotal As Long)
173      
174      responseNumber = responseNumber + 1
175      
176      ' Get the line from the server.
177 <    Winsock2.GetData response, vbString, bytesTotal
177 >    TCPSock.GetData response, vbString, bytesTotal
178      
179      ' Remove linefeeds and returns from the line.
180      response = Replace(response, Chr(13), "")
# Line 189 | Line 187 | Private Sub Winsock2_DataArrival(ByVal bytesTotal As L
187          Select Case responseNumber
188              Case 1:
189                  If Not response = "OK" Then GoTo configError
190 <                Winsock2.SendData "LASTMODIFIED" & vbCrLf
190 >                TCPSock.SendData "LASTMODIFIED" & vbCrLf
191              Case 2:
192                  If response = "ERROR" Then GoTo configError
193                  lastModified = response
194 <                Winsock2.SendData "FILELIST" & vbCrLf
194 >                TCPSock.SendData "FILELIST" & vbCrLf
195              Case 3:
196                  If response = "ERROR" Then GoTo configError
197                  fileList = response
198 <                Winsock2.SendData "UDPUpdateTime" & vbCrLf
198 >                TCPSock.SendData "UDPUpdateTime" & vbCrLf
199              Case 4:
200                  If response = "ERROR" Then GoTo configError
201 <                Winsock2.SendData "TCPUpdateTime" & vbCrLf
201 >                TCPSock.SendData "TCPUpdateTime" & vbCrLf
202              Case 5:
203                  If response = "ERROR" Then GoTo configError
204 <                Winsock2.SendData "ENDCONFIG" & vbCrLf
204 >                TCPSock.SendData "ENDCONFIG" & vbCrLf
205              Case 6:
206                  If Not response = "OK" Then GoTo configError
207 <                Winsock2.SendData "FILTER" & vbCrLf
207 >                TCPSock.SendData "FILTER" & vbCrLf
208              Case 7:
209                  'we got a filter list here.
210                  readTo = 0
# Line 220 | Line 218 | Private Sub Winsock2_DataArrival(ByVal bytesTotal As L
218                  response = Mid(response, readTo + 1, Len(response))
219                  ' get TCP Port number
220                  filterTCPPort = response
221 <                Winsock2.SendData "END" & vbCrLf
221 >                TCPSock.SendData "END" & vbCrLf
222              Case 8:
223                  If Not response = "OK" Then GoTo configError
224                  connected = True
225                  responseNumber = 0
226 <                Winsock2.Close
226 >                TCPSock.Close
227                  Text4.Text = Text4.Text & vbCrLf & "  <closed>"
228 <                x = MsgBox("got config okay")
228 >                Status.Caption = "i-scream Winhost " & protocolVersion & " - got config okay"
229          End Select
230      Else
231          ' Perform a heartbeat (1.1)
# Line 235 | Line 233 | Private Sub Winsock2_DataArrival(ByVal bytesTotal As L
233          Select Case responseNumber
234              Case 1:
235                  If Not response = "OK" Then GoTo heartbeatError
236 <                Winsock2.SendData "CONFIG" & vbCrLf
236 >                TCPSock.SendData "CONFIG" & vbCrLf
237              Case 2:
238                  If Not response = "OK" Then GoTo heartbeatError
239 <                Winsock2.SendData fileList & vbCrLf
239 >                TCPSock.SendData fileList & vbCrLf
240              Case 3:
241                  If Not response = "OK" Then GoTo heartbeatError
242 <                Winsock2.SendData lastModified & vbCrLf
242 >                TCPSock.SendData lastModified & vbCrLf
243              Case 4:
244                  If Not response = "OK" Then GoTo heartbeatError
245 <                Winsock2.SendData "ENDHEARTBEAT" & vbCrLf
245 >                TCPSock.SendData "ENDHEARTBEAT" & vbCrLf
246              Case 5:
247                  If Not response = "OK" Then GoTo heartbeatError
248 <                Winsock2.Close
249 <                x = MsgBox("heartbeat sent okay.")
248 >                TCPSock.Close
249 >                Status.Caption = "i-scream Winhost " & protocolVersion & " - heartbeat sent okay."
250          End Select
251      
252      End If
# Line 257 | Line 255 | Private Sub Winsock2_DataArrival(ByVal bytesTotal As L
255      Exit Sub
256      
257   configError:
258 <    x = MsgBox("error doing configuration")
258 >    Status.Caption = "i-scream Winhost " & protocolVersion & " - FAILED to get configuration"
259   heartbeatError:
260 <    x = MsgBox("error doing configuration")
260 >    Status.Caption = "i-scream Winhost " & protocolVersion & " - Heatbeat FAILED"
261   End Sub
262 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines