Dec 9, 2009

How to correctly close a socket

In order to close a socket, we shall use shutdown() and then close(). Shutdown() will notify the socket to shut itself down and release from read() command, while close() won't do those stuffs.

Therefore, if you used only close(), the blocking read() won't be released !