Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

shutdown() - close full duplex connection

&pagelevel(4)&pagelevel

#include <sys/socket.h>

int shutdown(int s, int how);

Description

The shutdown() function causes either one or both ends of a full duplex connection over a socket to be shut down. The s parameter designates the socket concerned.

shutdown() has the following effects, depending on the value of the how parameter:

  • If the how parameter has the value SHUT_RD, shutdown() prevents receiving further messages.

  • If the how parameter has the value SHUT_WR, shutdown() prevents sending further messages.

  • If the how parameter has the value SHUT_RDWR, shutdown() prevents both receiving and sending further messages.

Return value

0:

If successful.

-1:

If errors occur. errno is set to indicate the error.

Errors

EBADF

The s parameter is not a valid descriptor.

ENOTSOCK

Descriptor s references a file and not a socket.

ENOTCONN

The socket has no connection.

See also

connect(), socket()