shutdown

Shuts down all or part of a bidirectional connection on a socket. It can disallow further receives, further sends, or both.

Format

#include  <socket.h>

int shutdown  (int s, int how);

Arguments

s
A socket descriptor that is in a connected state as a result of a previous call to either connect or accept.
how
How the socket is to be shut down. Use one of the following values:
Disallows further calls to recv on the socket. 
Disallows further calls to send on the socket. 
Disallows further calls to both send and recv. 

Description

This routine allows communications on a socket to be shut down one piece at a time rather than all at once. It can be used to create unidirectional connections rather than the normal bidirectional (full-duplex) connections.

See also connect and socket in this section.

Return Values
Indicates success. 
-1  Indicates an error; errno is set to one of the following:

  • EBADF - The socket descriptor is invalid.

  • ENOTSOCK - The descriptor references a file, not a socket.

  • ENOTCONN - The specified socket is not connected.
 


Previous Page | Next Page | Table of Contents | Index