Unless I am reading the code incorrectly, a receiveBytes call on a DialogSocket is effectively useless. Because DialogSockets implements a secondary buffer, some unread bytes may already exist in this buffer and thus would be invisible to a direct receiveBytes call. receiveBytes would read the next length bytes from the socket directly.
Ideally is would be helpful if a receiveBytes implementation could be created in DialogSocket that is aware of the internal buffer. Alternately maybe a receiveBytes call should generate an exception of some type since it's behavior in DialogSocket is erratic at best.
Thanks for your time.