in my test.
close
will send fin packet and destroy fd immediately when socket is not shared with other processes
shutdown
SHUT_RD, process can still recv data from the socket, but recv
will return 0 if TCP buffer is empty.After peer send more data, recv
will return data again.
shutdown
SHUT_WR will send fin packet to indicate the Further sends are disallowed. the peer can recv data but it will recv 0 if its TCP buffer is empty
shutdown
SHUT_RDWR (equal to use both SHUT_RD and SHUT_WR) will send rst packet if peer send more data.