shutdown()

Shuts down a socket. This call may be used by either the server or client process.

Syntax

result = shutdown(socket, how)

int result, socket, how;

Parameters

result

0 if shutdown() is successful.

 

-1if a failure occurs.

socket

Socket descriptor of local socket to be shut down.

how

Method of shutdown, as follows:

 

0

Disallows further receives.

 

 

Once the socket has been shut down for

 

 

receives, all further recv() calls return -1,

 

 

with errno set to ESHUTDOWN.

 

1

Disallows further sends.

 

 

Once the socket has been shut down for

 

 

sends, all further send() calls return -1,

 

 

with errno set to ESHUTDOWN.

 

2

Disallows further sends and receives.

Berkeley Software Distribution Interprocess Communication 419