This might be considered a bug or a "feature" depending on how you look at it, but the "available()" call in a DialogSocket is effectively useless. "available()" doesn't know about DialogSockets' secondary buffer, so it's possible some data is sitting in the secondary buffer but nothing is available at the socket level. This would return false for data available when there is some in the secondary buffer. "available()" should check both places in a DialogSocket.
I reported a similar issue some time ago with receiveBytes() that lead to the creation of receiveRawBytes(). I'd guess you need some type of "availableRaw()" call if wish to solve it in a similar manner.
Out of curiosity, what's the reasoning for creating receiveRawBytes() instead just overriding receiveBytes()? Both receiveBytes() and available() have zero value in a DialogSocket and their use can cause very inconsistent problems. In my opinion, they should throw an exception at minimum just to prevent their use. If there is some limitation in overriding methods such as this in C++, I apologize. I'm still more use to Delphi's classes where this is common place.
Thanks for your time.