> (... after a few minutes) ok, i took my own advice and checked the bible, > and it contradicts the info page - shutdown(s, SHUT_WR) will send a FIN > _AFTER_ sending any queued data, and will fail any _new_ writes to the > socket.
Yes that's true (I waited patiently until I got home to check Stevens' book as well), but from what I gather and the Email I received from Shachar, his problem is that he wants to know asynchronically when to call shutdown, and I'm guessing all his sends are non-blocking. Technically you can view the shutdown (WR) as just "queueing" a FIN after all queued data, at least in it's default behavior. Although that partly solves his problem, he still needs to know when all data was received by the other side, so he'll know when to shutdown the read portion of the connection. Normally with a blocking socket this is not a problem, but a NB socket call will return immediately. For that I suggest sleeping in select() on the socket waiting for it to become readable. Once a FIN arrives (EOF), we shutdown the read portion of the connection. If sleeping is out of the question then select() should be used so it returns immediately. Eli -- Eli Kara Beyond Security Ltd. http://www.beyondsecurity.com/ http://www.securiteam.com/ The First Integrated Network and Web Application Vulnerability Scanner: http://www.beyondsecurity.com/webscan-wp.pdf ================================================================= 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]
