gtpc1m4eTransmission Control Protocol/Internet Protocol

shutdown -- Shut Down All or Part of a Duplex Connection

The shutdown function shuts down all or part of a duplex connection.

Format

#include  <socket.h>
int       shutdown(int s,
                   int how);

s
The socket descriptor.

how
Condition of the shutdown. Use one of the following values:

0
No more data can be received on socket s.

1
No more data can be sent on socket s.

2
No more data can be sent or received on socket s.

Normal Return

Return code 0 indicates that the function was successful.

Error Return

A return code equal to -1 indicates an error. You can get the specific error code by calling sock_errno. See Appendix C, Socket Error Return Codes for more information about socket errors.

Note:
Unless otherwise stated in the description, the following error codes can be returned for either TCP/IP offload support or TCP/IP native stack support.

Value
Description

SOCINVAL
The how parameter was not set to a valid value.

SOCNOTCONN
The socket was not connected.

SOCNOTSOCK
The s parameter is not a valid socket descriptor.

EIBMIUCVERR
Error occurred when the function call was sent to the offload device. This error code is returned only for TCP/IP offload support.

E1052STATE
The socket was closed because the system was in or cycling down to 1052 state.

EINACT
All offload devices associated with the socket descriptor have been disconnected. The socket is closed. This error code is returned only for TCP/IP offload support.

EINACTWS
An offload device associated with the socket descriptor has been disconnected. The socket is still available. This error code is returned only for TCP/IP offload support.

ESYSTEMERROR
A system error has occurred and closed the socket. This error code is returned only for TCP/IP offload support.

OFFLOADTIMEOUT
The offload device did not respond to the function call in the requested time period. This error code is returned only for TCP/IP offload support.

Programming Considerations

None.

Examples

In the following example, the read and write half of a duplex connection are shut down.

#include <socket.h>

·
·
·
int rc; int server_sock;
·
·
·
rc = shutdown(s, 2); /*shutdown both ends */

Related Information