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 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 sockfd is a file, not a socket.
34
36 POSIX.1-2001, 4.4BSD (the shutdown() function call 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 As currently implemented, checks for the validity of how are done in
45 domain-specific code, and not all domains perform these checks. Most
46 notably, UNIX domain sockets simply ignore invalid values; this may
47 change in the future.
48
50 connect(2), socket(2), socket(7)
51
53 This page is part of release 3.53 of the Linux man-pages project. A
54 description of the project, and information about reporting bugs, can
55 be found at http://www.kernel.org/doc/man-pages/.
56
57
58
59Linux 2012-09-06 SHUTDOWN(2)