NAME

shutdown -- disable sends and/or receives on a socket

LIBRARY

Standard C Library (libc, -lc)

SYNOPSIS

#include<sys/types.h>#include<sys/socket.h>intshutdown(ints, inthow);

DESCRIPTION

The shutdown() system call disables sends or receives on a socket. The
how argument specifies the type of shutdown. Possible values are:
SHUT_RD Further receives will be disallowed.
SHUT_WR Further sends will be disallowed. This may cause actions
specific to the protocol family of the socket s to happen; see
IMPLEMENTATIONNOTES.
SHUT_RDWR Further sends and receives will be disallowed. Implies
SHUT_WR.
If the file descriptor s is associated with a SOCK_STREAM socket, all or
part of the full-duplex connection will be shut down.

RETURNVALUES

The shutdown() function returns the value 0 if successful; otherwise the
value -1 is returned and the global variable errno is set to indicate the
error.

ERRORS

The shutdown() system call fails if:
[EBADF] The s argument is not a valid file descriptor.
[EINVAL] The how argument is invalid.
[EOPNOTSUPP] The socket associated with the file descriptor s does
not support this operation.
[ENOTCONN] The s argument specifies a SOCK_STREAM socket which is
not connected.
[ENOTSOCK] The s argument does not refer to a socket.