Visual Basic 6.0
Visual Basic 6.0
Receive Bytes up to a Delimiter into a BinData
See more Socket/SSL/TLS Examples
Demonstrates Socket.ReceiveUntilByteBd, which reads bytes until a delimiter byte is encountered and appends all bytes up to and including the delimiter to a BinData.
Background. The delimiter is a raw byte value from 0 through 255. This is useful for framing schemes that terminate each message with a known delimiter byte.
Chilkat Visual Basic 6.0 Downloads
Dim success As Long
success = 0
Dim socket As New ChilkatSocket
' Connect to the server using TLS.
Dim bTls As Long
bTls = 1
Dim maxWaitMs As Long
maxWaitMs = 5000
success = socket.Connect("example.com",5000,bTls,maxWaitMs)
If (success = 0) Then
Debug.Print socket.LastErrorText
Exit Sub
End If
' Read bytes until the delimiter byte is encountered, appending all bytes up to and including the
' delimiter to a BinData. The delimiter is a raw byte value from 0 through 255 (here the linefeed
' byte, decimal 10).
Dim bd As New ChilkatBinData
success = socket.ReceiveUntilByteBd(10,bd)
If (success = 0) Then
Debug.Print socket.LastErrorText
Exit Sub
End If
Debug.Print "Received " & bd.NumBytes & " bytes (including the delimiter)."