173 lines
3.5 KiB
HTML
173 lines
3.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SHUTDOWN</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SHUTDOWN</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2018-04-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
shutdown - shut down part of a full-duplex connection
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/sys/socket.h">sys/socket.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>int shutdown(int </B><I>sockfd</I><B>, int </B><I>how</I><B>);</B>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>shutdown</B>()
|
|
|
|
call causes all or part of a full-duplex connection on the socket
|
|
associated with
|
|
<I>sockfd</I>
|
|
|
|
to be shut down.
|
|
If
|
|
<I>how</I>
|
|
|
|
is
|
|
<B>SHUT_RD</B>,
|
|
|
|
further receptions will be disallowed.
|
|
If
|
|
<I>how</I>
|
|
|
|
is
|
|
<B>SHUT_WR</B>,
|
|
|
|
further transmissions will be disallowed.
|
|
If
|
|
<I>how</I>
|
|
|
|
is
|
|
<B>SHUT_RDWR</B>,
|
|
|
|
further receptions and transmissions will be disallowed.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success, zero is returned.
|
|
On error, -1 is returned, and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EBADF</B>
|
|
|
|
<DD>
|
|
<I>sockfd</I>
|
|
|
|
is not a valid file descriptor.
|
|
<DT id="2"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
An invalid value was specified in
|
|
<I>how</I>
|
|
|
|
(but see BUGS).
|
|
<DT id="3"><B>ENOTCONN</B>
|
|
|
|
<DD>
|
|
The specified socket is not connected.
|
|
<DT id="4"><B>ENOTSOCK</B>
|
|
|
|
<DD>
|
|
The file descriptor
|
|
<I>sockfd</I>
|
|
|
|
does not refer to a socket.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008, 4.4BSD
|
|
(<B>shutdown</B>()
|
|
|
|
first appeared in 4.2BSD).
|
|
<A NAME="lbAH"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The constants
|
|
<B>SHUT_RD</B>,
|
|
|
|
<B>SHUT_WR</B>,
|
|
|
|
<B>SHUT_RDWR</B>
|
|
|
|
have the value 0, 1, 2,
|
|
respectively, and are defined in
|
|
<I><<A HREF="file:///usr/include/sys/socket.h">sys/socket.h</A>></I>
|
|
|
|
since glibc-2.1.91.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
Checks for the validity of
|
|
<I>how</I>
|
|
|
|
are done in domain-specific code,
|
|
and before Linux 3.7 not all domains performed these checks.
|
|
|
|
Most notably, UNIX domain sockets simply ignored invalid values.
|
|
This problem was fixed for UNIX domain sockets
|
|
|
|
|
|
in Linux 3.7.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+close">close</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+connect">connect</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+socket">socket</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+socket">socket</A></B>(7)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="11"><A HREF="#lbAH">NOTES</A><DD>
|
|
<DT id="12"><A HREF="#lbAI">BUGS</A><DD>
|
|
<DT id="13"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="14"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:34 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|