9.62 shutdown

#define SHUT_RD   0b01
#define SHUT_RDWR 0b10
#define SHUT_WR   0b11

int shutdown(int sockfd, int how);

This syscall stops transmission or reception for a socket from a peer.

how signals how to stop communication, it can be the following values:

SHUT_RD

Further receiving will not be allowed.

SHUT_WR

Further transmitting will not be allowed.

SHUT_RDWR

Further receiving and transmitting will not be allowed.

The syscall returns 0 on success or -1 on failure, with the following errno:

EINVAL

The passed FD was a non bound socket.

EBADF

The passed file is valid but it was not a physical file in a filesystem.