According to the docs, it is possible for an SSLSocket to get a DataAvailable event but no data. How does this “no data” manifest itself?
If one is reading into a MemoryBlock using the ReadAll method, is the Size of that MemoryBlock zero after the ReadAll?
Is the BytesAvailable property zero after the event?
or something else or both or neither?
I usually just check
socket.Lookahead.LenB to see how many bytes are actually available.
You mean instead of doing a
Right. Unlike Read/ReadAll, Lookahead doesn’t remove the bytes in the socket’s internal buffer. This lets you peek at the buffer and read only as many bytes as you actually need, leaving the rest in the buffer for later.
Do Until Me.Lookahead.LenB >= MessageSize ' at least one full message is in the buffer
Dim message As MemoryBlock = Me.Read(MessageSize ) ' remove one full message from the buffer