> We find that, when a client has already closed the socket and server
> tries to write some data to that socket using select() & write()
> systems calls, they succeeds. Has any body faced similar problem?
> Is there any TCP driver paramteres which we can configure so that
> the select()/write() calls detects the stale socket handle and
> retruns error?
Select for both read and write on the socket, check read first. If the
return from read is zero, it means the remote has called either
shutdown or close - you have just received the TCP FIN segment. You
have to know more about the client to know if it simply calls close(),
in which case it will neither send, nor recv any more data, or if it
called shutdown(), in which case it may have simply stated it will no
longer send data but will still recv it.
There will always be a window. Your app could select on the socket,
and come-out of select and enter write just before the client closed
his end of the connection.
these opinions are mine, all mine; HP might not want them anyway... :)
feel free to email, OR post, but please do NOT do BOTH...
my email address is raj in the cup.hp.com domain...