1shutdown(2) System Calls Manual shutdown(2)
2
3
4
6 shutdown - shut down part of a full-duplex connection
7
9 Standard C library (libc, -lc)
10
12 #include <sys/socket.h>
13
14 int shutdown(int sockfd, int how);
15
17 The shutdown() call causes all or part of a full-duplex connection on
18 the socket associated with sockfd to be shut down. If how is SHUT_RD,
19 further receptions will be disallowed. If how is SHUT_WR, further
20 transmissions will be disallowed. If how is SHUT_RDWR, further recep‐
21 tions and transmissions will be disallowed.
22
24 On success, zero is returned. On error, -1 is returned, and errno is
25 set to indicate the error.
26
28 EBADF sockfd is not a valid file descriptor.
29
30 EINVAL An invalid value was specified in how (but see BUGS).
31
32 ENOTCONN
33 The specified socket is not connected.
34
35 ENOTSOCK
36 The file descriptor sockfd does not refer to a socket.
37
39 POSIX.1-2008.
40
42 POSIX.1-2001, 4.4BSD (first appeared in 4.2BSD).
43
45 The constants SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, re‐
46 spectively, and are defined in <sys/socket.h> since glibc-2.1.91.
47
49 Checks for the validity of how are done in domain-specific code, and
50 before Linux 3.7 not all domains performed these checks. Most notably,
51 UNIX domain sockets simply ignored invalid values. This problem was
52 fixed for UNIX domain sockets in Linux 3.7.
53
55 close(2), connect(2), socket(2), socket(7)
56
57
58
59Linux man-pages 6.05 2023-03-30 shutdown(2)