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

Comparing projects/cms/source/host/winhost/nettest.frm (file contents):
Revision 1.1 by pjm2, Thu Feb 22 17:04:22 2001 UTC vs.
Revision 1.2 by pjm2, Fri Feb 23 09:42:36 2001 UTC

# Line 119 | Line 119 | Attribute VB_GlobalNameSpace = False
119   Attribute VB_Creatable = False
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
125 +
126 + Dim protocolVersion As String
127 + Dim connected As Boolean
128   Dim responseNumber As Integer
129  
130  
131   Private Sub Command1_Click()
132  
133 <    ' Use the first winsock control to send
128 <    ' a UDP packet.
133 >    ' Use the first winsock control to send a UDP packet.
134      Winsock1.RemoteHost = Text3.Text
135      Winsock1.RemotePort = Text2.Text
136      Winsock1.SendData Text1.Text
# Line 144 | Line 149 | Private Sub Command3_Click()
149      x = MsgBox("not implemented..")
150   End Sub
151  
152 + Private Sub Form_Load()
153 +    protocolVersion = "1.1"
154 + End Sub
155 +
156   Private Sub Winsock2_Connect()
157        
158     responseNumber = 0
# Line 165 | Line 174 | Private Sub Winsock2_DataArrival(ByVal bytesTotal As L
174      response = Replace(response, Chr(10), "")
175      Text4.Text = Text4.Text & vbCrLf & response
176      
177 <    ' Decide what to send back to the server.
178 <    Select Case responseNumber
179 <        Case 1:
180 <            Winsock2.SendData "LASTMODIFIED" & vbCrLf
181 <        Case 2:
182 <            Winsock2.SendData "FILELIST" & vbCrLf
183 <        Case 3:
184 <            Winsock2.SendData "UDPUpdateTime" & vbCrLf
185 <        Case 4:
186 <            Winsock2.SendData "TCPUpdateTime" & vbCrLf
187 <        Case 5:
188 <            Winsock2.SendData "ENDCONFIG" & vbCrLf
189 <        Case 6:
190 <            Winsock2.SendData "FILTER" & vbCrLf
191 <        Case 7:
192 <            Winsock2.SendData "END" & vbCrLf
193 <        Case 8:
194 <            Winsock2.Close
195 <            Text4.Text = Text4.Text & vbCrLf & "  <closed>"
196 <    End Select
177 >    If connected = False Then
178 >        ' Perform TCP configuration (1.1)
179 >        On Error GoTo configError
180 >        Select Case responseNumber
181 >            Case 1:
182 >                If Not response = "OK" Then GoTo configError
183 >                Winsock2.SendData "LASTMODIFIED" & vbCrLf
184 >            Case 2:
185 >                If response = "ERROR" Then GoTo configError
186 >                Winsock2.SendData "FILELIST" & vbCrLf
187 >            Case 3:
188 >                If response = "ERROR" Then GoTo configError
189 >                Winsock2.SendData "UDPUpdateTime" & vbCrLf
190 >            Case 4:
191 >                If response = "ERROR" Then GoTo configError
192 >                Winsock2.SendData "TCPUpdateTime" & vbCrLf
193 >            Case 5:
194 >                If response = "ERROR" Then GoTo configError
195 >                Winsock2.SendData "ENDCONFIG" & vbCrLf
196 >            Case 6:
197 >                If Not response = "OK" Then GoTo configError
198 >                Winsock2.SendData "FILTER" & vbCrLf
199 >            Case 7:
200 >                'we got a filter list here.
201 >                readTo = 0
202 >                ' get hostname
203 >                readTo = InStr(1, response, ";", vbBinaryCompare)
204 >                filterHostname = Mid(response, 1, readTo - 1)
205 >                response = Mid(response, readTo + 1, Len(response))
206 >                ' get UDP Port number
207 >                readTo = InStr(1, response, ";")
208 >                filterUDPPort = Mid(response, 1, readTo - 1)
209 >                response = Mid(response, readTo + 1, Len(response))
210 >                ' get TCP Port number
211 >                filterTCPPort = response
212 >                Winsock2.SendData "END" & vbCrLf
213 >            Case 8:
214 >                If Not response = "OK" Then GoTo configError
215 >                connected = True
216 >                responseNumber = 0
217 >                Winsock2.Close
218 >                Text4.Text = Text4.Text & vbCrLf & "  <closed>"
219 >                x = MsgBox("got config okay")
220 >        End Select
221 >    Else
222 >        ' Perform a heartbeat (1.1)
223 >        On Error GoTo heartbeatError
224 >        Select Case responseNumber
225 >            Case 1:
226 >                
227 >            Case 2:
228 >                
229 >            Case 3:
230 >                
231 >            Case 4:
232 >                
233 >            Case 5:
234 >                
235 >            Case 6:
236 >                
237 >            Case 7:
238 >                
239 >            Case 8:
240 >                
241 >        End Select
242 >    
243 >    End If
244 >    
245 >    
246 >    Exit Sub
247 >    
248 > configError:
249 >    x = MsgBox("error doing configuration")
250 > heartbeatError:
251      
252   End Sub

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines