Add-Ons & Services

SocketImpl::receiveBytes question/suggestion

Please post support and help requests here.

SocketImpl::receiveBytes question/suggestion

Postby merdem » 11 Aug 2006, 18:06


Examining the SocketImpl class, I found out that the SocketImpl::receiveBytes method does not report a graceful close from peer.

The Unix documentation of recv() says it returns 0 in such a case.

Is this a design decision? Is it intentionally left to the user to check for this case? Wouldn't it be better to check it in SocketImpl::receiveBytes and throw an exception?

By the way, congrats on this excellent library. I am still amazed.

Posts: 14
Joined: 19 Jul 2006, 22:28

Re: SocketImpl::receiveBytes question/suggestion

Postby guenter » 11 Aug 2006, 18:42

For receiveBytes(), a return value of 0 means a graceful close from the peer (I have clarified the documentation). Throwing an exception in this case would be bad design, because a graceful close is usually an expected condition, in contrast to an aborted or reset connection (in which case an exception is thrown).
Posts: 1165
Joined: 11 Jul 2006, 16:27
Location: Austria

Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests