Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/shutdown.html
2024-02-19 00:21:47 -05:00

169 lines
4.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>shutdown</title>
</head>
<body bgcolor="white">
<basefont size="3"> <a name="shutdown"></a> <a name="tag_03_679"></a><!-- shutdown -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_679_01"></a>NAME</h4>
<blockquote>shutdown - shut down socket send and receive operations</blockquote>
<h4><a name="tag_03_679_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>#include &lt;<a href="../basedefs/sys/socket.h.html">sys/socket.h</a>&gt;<br>
<br>
int shutdown(int</tt> <i>socket</i><tt>, int</tt> <i>how</i><tt>);<br>
</tt></code></p>
</blockquote>
<h4><a name="tag_03_679_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>shutdown</i>() function shall cause all or part of a full-duplex connection on the socket associated with the file
descriptor <i>socket</i> to be shut down.</p>
<p>The <i>shutdown</i>() function takes the following arguments:</p>
<dl compact>
<dt><i>socket</i></dt>
<dd>Specifies the file descriptor of the socket.</dd>
<dt><i>how</i></dt>
<dd>Specifies the type of shutdown. The values are as follows:
<dl compact>
<dt>SHUT_RD</dt>
<dd>Disables further receive operations.</dd>
<dt>SHUT_WR</dt>
<dd>Disables further send operations.</dd>
<dt>SHUT_RDWR</dt>
<dd>Disables further send and receive operations.</dd>
</dl>
</dd>
</dl>
<p>The <i>shutdown</i>() function disables subsequent send and/or receive operations on a socket, depending on the value of the
<i>how</i> argument.</p>
</blockquote>
<h4><a name="tag_03_679_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, <i>shutdown</i>() shall return 0; otherwise, -1 shall be returned and <i>errno</i> set to indicate
the error.</p>
</blockquote>
<h4><a name="tag_03_679_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>shutdown</i>() function shall fail if:</p>
<dl compact>
<dt>[EBADF]</dt>
<dd>The <i>socket</i> argument is not a valid file descriptor.</dd>
<dt>[EINVAL]</dt>
<dd>The <i>how</i> argument is invalid.</dd>
<dt>[ENOTCONN]</dt>
<dd>The socket is not connected.</dd>
<dt>[ENOTSOCK]</dt>
<dd>The <i>socket</i> argument does not refer to a socket.</dd>
</dl>
<p>The <i>shutdown</i>() function may fail if:</p>
<dl compact>
<dt>[ENOBUFS]</dt>
<dd>Insufficient resources were available in the system to perform the operation.</dd>
</dl>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_679_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_679_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_679_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_679_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_679_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="getsockopt.html"><i>getsockopt</i>()</a> , <a href="read.html"><i>read</i>()</a> , <a href=
"recv.html"><i>recv</i>()</a> , <a href="recvfrom.html"><i>recvfrom</i>()</a> , <a href="recvmsg.html"><i>recvmsg</i>()</a> , <a
href="select.html"><i>select</i>()</a> , <a href="send.html"><i>send</i>()</a> , <a href="sendto.html"><i>sendto</i>()</a> , <a
href="setsockopt.html"><i>setsockopt</i>()</a> , <a href="socket.html"><i>socket</i>()</a> , <a href=
"write.html"><i>write</i>()</a> , the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href=
"../basedefs/sys/socket.h.html"><i>&lt;sys/socket.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_679_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 6. Derived from the XNS, Issue 5.2 specification.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>