DialogSocket real "available"

Discussion of ideas for features and new projects based on POCO.
Posts: 7
Joined: 12 Jul 2010, 04:12

DialogSocket real "available"

Postby delphi13 » 09 Feb 2012, 02:29


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.

Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: DialogSocket real "available"

Postby alex » 16 May 2012, 05:02

I just glanced over it but you may have a point there. Modify code, run/extend tests, submit a patch and we'll look into it for the next release.

Posts: 1
Joined: 16 Mar 2015, 11:38

Re: DialogSocket real "available"

Postby anosh » 16 Mar 2015, 11:43

I wanted to use a Net::SocketReactor to deliver read notifications of when I can read data from the source socket and append it to the streambuf, and use write notifications when I can write some or all of the buffered data to the destination socket.
anosh g

Return to “Wishlist”

Who is online

Users browsing this forum: No registered users and 2 guests