[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Communications Technical Reference, Volume 2

shutdown Subroutine

Purpose

Shuts down all socket send and receive operations.

Library

Standard C Library (libc.a)

Syntax


#include <sys/socket.h>

int shutdown (Socket, How)
int Socket, How;

Description

The shutdown subroutine disables all receive and send operations on the specified socket.

Parameters

Socket Specifies the unique name of the socket.
How Specifies the type of subroutine shutdown. Use the following values:
0 Disables further receive operations.
1 Disables further send operations.
2 Disables further send operations and receive operations.

Return Values

Upon successful completion, a value of 0 is returned.

If the shutdown subroutine is unsuccessful, the subroutine handler performs the following functions:

Error Codes

The shutdown subroutine is unsuccessful if any of the following errors occurs:

EBADF The Socket parameter is not valid.
ENOTSOCK The Socket parameter refers to a file, not a socket.
ENOTCONN The socket is not connected.

Implementation Specifics

The shutdown subroutine is part of Base Operating System (BOS) Runtime.

All applications containing the shutdown subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Files

/usr/include/sys/socket.h Contains socket definitions.
/usr/include/sys/types.h Contains definitions of unsigned data types.

Related Information

The getsockopt subroutine, recv subroutine, recvfrom subroutine, recvmsg subroutine, read subroutine, select subroutine, send subroutine, sendto subroutine, setsockopt subroutine, socket subroutine, write subroutine.

Sockets Overview in AIX Version 4.3 Communications Programming Concepts.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]