1SHUTDOWN(2) Linux Programmer's Manual SHUTDOWN(2)
2
3
4
6 shutdown - shut down part of a full-duplex connection
7
9 #include <sys/socket.h>
10
11 int shutdown(int sockfd, int how);
12
14 The shutdown() call causes all or part of a full-duplex connection on
15 the socket associated with sockfd to be shut down. If how is SHUT_RD,
16 further receptions will be disallowed. If how is SHUT_WR, further
17 transmissions will be disallowed. If how is SHUT_RDWR, further recep‐
18 tions and transmissions will be disallowed.
19
21 On success, zero is returned. On error, -1 is returned, and errno is
22 set appropriately.
23
25 EBADF sockfd is not a valid file descriptor.
26
27 EINVAL An invalid value was specified in how (but see BUGS).
28
29 ENOTCONN
30 The specified socket is not connected.
31
32 ENOTSOCK
33 The file descriptor sockfd does not refer to a socket.
34
36 POSIX.1-2001, POSIX.1-2008, 4.4BSD (shutdown() first appeared in
37 4.2BSD).
38
40 The constants SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2,
41 respectively, and are defined in <sys/socket.h> since glibc-2.1.91.
42
44 Checks for the validity of how are done in domain-specific code, and
45 before Linux 3.7 not all domains performed these checks. Most notably,
46 UNIX domain sockets simply ignored invalid values. This problem was
47 fixed for UNIX domain sockets in Linux 3.7.
48
50 connect(2), socket(2), socket(7)
51
53 This page is part of release 4.15 of the Linux man-pages project. A
54 description of the project, information about reporting bugs, and the
55 latest version of this page, can be found at
56 https://www.kernel.org/doc/man-pages/.
57
58
59
60Linux 2016-03-15 SHUTDOWN(2)