Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

shutdown() - terminate full-duplex connection

&pagelevel(3)&pagelevel

#include <sys.socket.h>


Kernighan-Ritchie-C:
int shutdown(s, how);

int s, how;

ANSI-C:
int shutdown(int s, int how);


Description

The shutdown() function limits the functionality of the socket and terminates the connection completely or in part. However, the socket still remains. The socket can be closed with the soc_close() function.

The shutdown() function is supported in the AF_INET and AF_INET6 address families.

The how parameter controls how the connection belonging to socket s should be terminated. The following values of how can be used:

SHUT_RD:

Read access is not possible for the socket, i.e. a read function can no longer be executed. This functionality can cause problems in the application because the partner socket is not informed of this limitation.

If the partner socket continues to send data, this can lead to a jam situation: The sent data uses memory in the transport system and these resources cannot be released because the data has not been fetched by the receiver. If the memory resources are used up, data can also no longer be sent.

SHUT_WR:

Write access is not possible for the socket. The partner socket is informed that data can no longer be sent from this socket. This corresponds to a “graceful disconnect”.

SHUT_RDWR:

Read and write access are not possible for the socket. The partner socket is informed that data cannot be sent or read. This is corresponds to an “abortive disconnect”.

Return value

0:

If successful

-1:

If errors occur. errno is set to indicate the error. 

Errors indicated by errno

EBADF

The s parameter is not a valid descriptor.

ENOTCONN

No connection exists for the socket.

Note

Up to SOCKETS(BS2000) < V.2.1 the shutdown() function was supported without functionality, i.e. the call was not rejected, however no action was executed.

The functionality described above is provided if the user program has been compiled with the user library of SOCKETS(BS2000) as of version 2.1.

See also

soc_close()