8
–
LEt option
62
Private Sub Command2_Click()
‘When Command1button clicked
Dim rdata As String
Dim I As Long
On Error GoTo ErrorHandler
Label3.Caption = ""
Label5.Caption = ""
rdata = ""
For I = 0 To 30000
rdata = rdata & strReadBuffer
strReadBuffer = ""
If InStr(rdata, vbCr) <> 0 Then
‘Confirm until carriage return is sent.
Exit For
End If
Next I
If I > 30000 Then
GoTo ErrorHandler
End If
Label3.Caption = rdata
'Indicate the data received
Label5.Caption = "Read OK!"
Exit Sub
ErrorHandler:
Label5.Caption = "Read NG!"
End Sub
‘When Winsock1 new data is sent.
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
‘Winsock1
Dim rdata As String
Winsock1.GetData rdata
‘Gobble down data
strReadBuffer = strReadBuffer & rdata
‘Add gobble downed data to buffer
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
‘Close Winsock1
End Sub
Summary of Contents for 35
Page 2: ...Dummy Page ...
Page 5: ...iii Dummy Page ...
Page 6: ......
Page 71: ...8 LEt option 65 ...
Page 72: ...8 LEt option 66 ...
Page 73: ...8 LEt option 67 ...