this is a great thread - i'm learning a lot by reading it, even though i've been programming sockets for years. thanks for the question, and thanks for all the great answers.
Another point to check - does the read(2) after select(2) return an error? See select_tut(2) for more details on how to program with select - you should check for errors as well instead of just assuming that read(2) must succeed (e.g. interrupt). Also while you are at it - check whether pselect(2) can help you improve your program's robustness.
there is a distinction between different types of read() errors. at the very least, if you set the non-blocking option, you will get a response indicating that there is no data. if you select a non-zero timeout, you get a different return value indicating the timeout was hit w/ no data. if the other side disconnects, you get a different failure, and finally, there is a catch-all error for other reasons. IIRC, this was also somewhat implementation specific. it's been awhile, and it may have been Linux/OS X differences, but i would recommend that you are looking at the appropriate man page for your stack. if you do a random google, you may get the netbsd/freebsd stack, which may be different.
Maybe using poll(2) will help you around that (I also heard that poll is generally more efficient because it helps the kernel avoid having to re-interpret the syscall parameters on every call).
this is interesting. can anyone provide more info on this? thanks, michael ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
