SHUTDOWN(3P)
π SHUTDOWN(3P) β the POSIX Programmer's Manual era π
okay bestie, quick vibe check before we dive in: this page is part of the POSIX Programmer's Manual, and the Linux implementation of this interface may differ β so if you're on Linux, go peek at the corresponding Linux manual page for the deets on Linux behavior. orrr the interface might not even be implemented on Linux at all. π no cap, always double-check.
β¨ NAME β¨
shutdown β shut down socket send and receive operations π
π SYNOPSIS π
#include <sys/socket.h>
int shutdown(int socket, int how);
πΈ DESCRIPTION πΈ
so like. the shutdown() function shall cause all or part of a full-duplex connection on the socket associated with the file descriptor socket to be shut down. it's giving "we're closing the group chat, but maybe just one direction of it." π
shutdown() takes these arguments, bestie:
socketβ specifies the file descriptor of the socket. it's literally the socket's little name tag. π·οΈhowβ specifies the type of shutdown. the values are as follows:SHUT_RDβ disables further receive operations. π βοΈπ₯SHUT_WRβ disables further send operations. π βοΈπ€SHUT_RDWRβ disables further send and receive operations. both directions, gone, iconic. βοΈ
so yeah β shutdown() disables subsequent send and/or receive operations on a socket, depending on the value of the how argument. the how argument is truly the main character here, deciding which direction of the conversation gets ghosted. π
β RETURN VALUE β
upon successful completion, shutdown() shall return 0. slay. π
otherwise, -1 shall be returned and errno set to indicate the error. not slay. π
π ERRORS π
the shutdown() function shall fail if:
EBADFβ thesocketargument is not a valid file descriptor. that's not a real socket, bestie, that's a fake ID. πͺͺEINVALβ thehowargument is invalid. you gave it a vibe it does not recognize. π«ENOTCONNβ the socket is not connected. it's giving "we were never even talking??" π«ENOTSOCKβ thesocketargument does not refer to a socket. wrong item, wrong aisle. π
the shutdown() function may fail if:
ENOBUFSβ insufficient resources were available in the system to perform the operation. the system was simply not built for this today. πΈ
heads up: the following sections are informative. they're the bonus tracks, not the main album. π§
π EXAMPLES π
None. (yes, literally none. we're on our own, bestie. π§)
π APPLICATION USAGE π
None. (also none. the manual is being mysterious and honestly? respect. β¨)
π¦ RATIONALE π¦
None. (nothing here either. it's giving minimalism. π)
π FUTURE DIRECTIONS π
None. (the future is, apparently, undefined. π)
π SEE ALSO π
go read these too, they're all in the same friend group:
getsockopt(), pselect(), read(), recv(), recvfrom(), recvmsg(), send(), sendto(), setsockopt(), socket(), write()
and from the Base Definitions volume of POSIX.1β2017: <sys_socket.h> π
π₯ COPYRIGHT π₯
okay this part is serious, so listen up. portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.
in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . π
and that's the whole page, bestie!! courtesy of IEEE/The Open Group, dated 2017 β SHUTDOWN(3P) and out. go forth and close those socket connections with main character energy. periodt. π
β¨π«Ά
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms