[LIP] TCP/IP socket-library design dilemma

Shantanu Kumar <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Hi all,

I am writing a C++ library for working with TCP/IP sockets. I have a
design dilemma, as explained below. Please let me know your comments.

The story pertains to a connected regular socket (not a listening server
socket). After the connection is closed by foreign host, select () with
the RD bit on for the socket still returns TRUE, but recv () and read ()
return 0 (ZERO). Would it be wrong for my Socket::read () method to
throw an appropriate exception instead of returning the same ZERO?

To me, the intuitive way is to throw an exception but even Java doesn't
use that approach in its API. So, I am wondering whether there's
something wrong with my idea or I am overlooking any subtle aspect.


Regards,
Shantanu
-- 
In a world without walls and fences, who needs windows and gates?



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.