1SHUTDOWN(P) POSIX Programmer's Manual SHUTDOWN(P)
2
3
4
6 shutdown - shut down socket send and receive operations
7
9 #include <sys/socket.h>
10
11 int shutdown(int socket, int how);
12
13
15 The shutdown() function shall cause all or part of a full-duplex con‐
16 nection on the socket associated with the file descriptor socket to be
17 shut down.
18
19 The shutdown() function takes the following arguments:
20
21 socket Specifies the file descriptor of the socket.
22
23 how Specifies the type of shutdown. The values are as follows:
24
25 SHUT_RD
26 Disables further receive operations.
27
28 SHUT_WR
29 Disables further send operations.
30
31 SHUT_RDWR
32 Disables further send and receive operations.
33
34
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
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
64 The following sections are informative.
65
67 None.
68
70 None.
71
73 None.
74
76 None.
77
79 getsockopt() , read() , recv() , recvfrom() , recvmsg() , select() ,
80 send() , sendto() , setsockopt() , socket() , write() , the Base Defi‐
81 nitions volume of IEEE Std 1003.1-2001, <sys/socket.h>
82
84 Portions of this text are reprinted and reproduced in electronic form
85 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
86 -- Portable Operating System Interface (POSIX), The Open Group Base
87 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
88 Electrical and Electronics Engineers, Inc and The Open Group. In the
89 event of any discrepancy between this version and the original IEEE and
90 The Open Group Standard, the original IEEE and The Open Group Standard
91 is the referee document. The original Standard can be obtained online
92 at http://www.opengroup.org/unix/online.html .
93
94
95
96IEEE/The Open Group 2003 SHUTDOWN(P)