In C, I understood that if we close a socket, it means the socket will be destroyed and can be re-used later.
How about shutdown? The description said it closes half of a duplex connection to that socket. But will that socket be destroyed like
This is explained in Beej's networking guide.
shutdown is a flexible way to block communication in one or both directions. When the second parameter is
SHUT_RDWR, it will block both sending and receiving (like
close is the way to actually destroy a socket.
shutdown, you will still be able to receive pending data the peer already sent (thanks to Joey Adams for noting this).