shutdown

Top  Previous  Next

The shutdown function disables sends or receives on a socket.

The shutdown function causes all or part of  a full-duplex connection on the socket associated with the descriptor socket to be shut down. The shutdown function disables subsequent send and/or receive operations on a socket, depending on the value of the how argument.

 

Syntax

int shutdown(

int socket,

int how

);

 

Parameters

socket

The descriptor that identifies a connected socket.

 

how

A flag that describes what types of operation will no longer be allowed.  The following table lists the values supported:

 

Type

Meaning

SHUT_RD

Disables further receive operations.

SHUT_WR

Disables further send operations.

SHUT_RDWR

Disables further send and receive operations.

 

Return value

Upon successful completion, shutdown returns 0; otherwise, -1 is returned and errno set to indicate the error.