On the basis of shutdown vs close I have known the difference between shutdown and close.
But which will choose if select timeout in socket, the client will close or shutdown(sock, SHUT_WR).
I try to read the source code of select.c, but it is too hard to read.
Can anyone give me some help.
But which will choose if select timeout in socket, the client will close or shutdown(sock, SHUT_WR).
If the client has a call to select()
, the client can decide what to do when that call times out.
Almost by definition, if your select()
times out, it's telling you that nothing happened to the socket (nothing that you told select()
you were interested in, anyway).
Sockets don't automatically close (or shutdown) just because nothing happened for a while. You have to do that yourself, if you want it.