1SHUTDOWN(3P) POSIX Programmer's Manual SHUTDOWN(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 shutdown — shut down socket send and receive operations
13
15 #include <sys/socket.h>
16
17 int shutdown(int socket, int how);
18
20 The shutdown() function shall cause all or part of a full-duplex con‐
21 nection on the socket associated with the file descriptor socket to be
22 shut down.
23
24 The shutdown() function takes the following arguments:
25
26 socket Specifies the file descriptor of the socket.
27
28 how Specifies the type of shutdown. The values are as follows:
29
30 SHUT_RD Disables further receive operations.
31
32 SHUT_WR Disables further send operations.
33
34 SHUT_RDWR Disables further send and receive operations.
35
36 The shutdown() function disables subsequent send and/or receive opera‐
37 tions on a socket, depending on the value of the how argument.
38
40 Upon successful completion, shutdown() shall return 0; otherwise, -1
41 shall be returned and errno set to indicate the error.
42
44 The shutdown() function shall fail if:
45
46 EBADF The socket argument is not a valid file descriptor.
47
48 EINVAL The how argument is invalid.
49
50 ENOTCONN
51 The socket is not connected.
52
53 ENOTSOCK
54 The socket argument does not refer to a socket.
55
56 The shutdown() function may fail if:
57
58 ENOBUFS
59 Insufficient resources were available in the system to perform
60 the operation.
61
62 The following sections are informative.
63
65 None.
66
68 None.
69
71 None.
72
74 None.
75
77 getsockopt(), pselect(), read(), recv(), recvfrom(), recvmsg(), send(),
78 sendto(), setsockopt(), socket(), write()
79
80 The Base Definitions volume of POSIX.1‐2017, <sys_socket.h>
81
83 Portions of this text are reprinted and reproduced in electronic form
84 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
85 table Operating System Interface (POSIX), The Open Group Base Specifi‐
86 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
87 Electrical and Electronics Engineers, Inc and The Open Group. In the
88 event of any discrepancy between this version and the original IEEE and
89 The Open Group Standard, the original IEEE and The Open Group Standard
90 is the referee document. The original Standard can be obtained online
91 at http://www.opengroup.org/unix/online.html .
92
93 Any typographical or formatting errors that appear in this page are
94 most likely to have been introduced during the conversion of the source
95 files to man page format. To report such errors, see https://www.ker‐
96 nel.org/doc/man-pages/reporting_bugs.html .
97
98
99
100IEEE/The Open Group 2017 SHUTDOWN(3P)