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