SCTP_PEELOFF(3)
π SCTP_PEELOFF(3) π
okay bestie, welcome to the Linux Programmer's Manual page for sctp_peeloff β yes it's a real one, yes it's from the SCTP corner of the socket world, and yes we're gonna make it make sense. β¨
πΈ NAME πΈ
sctp_peeloff β Branch off an association into a separate socket.
π SYNOPSIS π
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_peeloff(int sd, sctp_assoc_t assoc_id);
int sctp_peeloff_flags(int sd, sctp_assoc_t assoc_id, unsigned flags);
π¦ DESCRIPTION π¦
so like. sctp_peeloff takes an existing association assoc_id that's living on a one-to-many style socket sd, and branches it off into its own separate socket. and the new socket? it's a one-to-one style socket. it's giving glow-up, it's giving main character, it's giving "you get your own file descriptor now bestie." π
why would you even want this, you ask? imagine your app has a bunch of sporadic message senders/receivers just chilling under the original one-to-many style socket, and then there's that one association carrying high volume data traffic like it's trying to be famous. you peel that one off into its own separate socket descriptor so it stops hogging the vibe. the sporadic ones stay put, the loud one gets its own room. periodt. π₯
sctp_peeloff_flags is the variant of sctp_peeloff where you can also pass flags describing how the newly peeled off socket should behave. right now the supported flags are:
SOCK_NONBLOCKβ says the new socket should not block on io operations. no waiting around, no standing in line. β¨SOCK_CLOEXECβ says the new socket should be closed when the owning process callsexec. it does not survive the exec, no cap. π«Ά
β RETURN VALUE β
on success, you get back the new socket descriptor representing the branched-off association (yes, the original says "asociation", we're not fixing it, we're honoring it π).
on error, -1 comes back and errno gets set appropriately. rude but informative.
π ERRORS π
EBADFβsdis not a valid descriptor. bestie that's not a socket that's a vibe void. πEINVALβ the assoc id you passed is invalid, or the socket is a one-to-one style socket. (peeling off a one-to-one is not a thing, sorry.) πENOTSOCKβ the argument is a descriptor for a file, not a socket. wrong door, wrong building, wrong genre. π
π NOTES π
sctp_peeloff_flags is a linux specific variant of sctp_peeloff. it will compile on other systems, but using it there will result in an error return. so if you want portable code β and you do, bestie β use sctp_peeloff. π§
π SEE ALSO π
sctp(7) sctp_bindx(3), sctp_connectx(3), sctp_sendmsg(3), sctp_sendv(3), sctp_send(3), sctp_recvmsg(3), sctp_recvv(3), sctp_getpaddrs(3), sctp_getladdrs(3), sctp_opt_info(3),
and that's the whole page, bestie. this one's stamped Linux 2.6, dated 2005-10-25, straight from the SCTP_PEELOFF(3) archives. go branch off an association and slay πβ¨π
π¦ where this page comes from
- alpine 3.22: lksctp-tools-doc 1.0.19-r5 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.23: lksctp-tools-doc 1.0.19-r5 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- alpine 3.24: lksctp-tools-doc 1.0.19-r5 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- arch rolling: lksctp-tools 1.0.21-1 Β· GPL-2.0-or-later AND LGPL-2.1-only
- centos-stream 10: lksctp-tools-devel 1.0.21-1.el10 Β· GPLv2 and GPLv2+ and LGPLv2 and MIT
- centos-stream 9: lksctp-tools-devel 1.0.19-2.el9 Β· GPLv2 and GPLv2+ and LGPLv2 and MIT
- centos-stream 9: lksctp-tools-devel 1.0.19-2.el9 Β· GPLv2 and GPLv2+ and LGPLv2 and MIT
- debian bookworm: libsctp-dev 1.0.19+dfsg-2 Β· GPL-2.0-or-later
- debian trixie: libsctp-dev 1.0.21+dfsg-1 Β· GPL-2.0-or-later
- fedora 43: lksctp-tools-devel 1.0.21-1.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 43: lksctp-tools-devel 1.0.21-1.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 44: lksctp-tools-devel 1.0.21-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- fedora 44: lksctp-tools-devel 1.0.21-3.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-only AND MIT
- nixos 26.05: lksctp-tools 1.0.21
- nixpkgs unstable: lksctp-tools 1.0.21
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: lksctp-tools-devel 1.0.21-160000.3.2 Β· LGPL-2.1-or-later
- ubuntu jammy: libsctp-dev 1.0.19+dfsg-1build1 Β· GPL-2.0-or-later
- ubuntu noble: libsctp-dev 1.0.19+dfsg-2build1 Β· GPL-2.0-or-later
- ubuntu questing: libsctp-dev 1.0.21+dfsg-1build1
- ubuntu resolute: libsctp-dev 1.0.21+dfsg-1build2 Β· GPL-2.0-or-later
- ubuntu stonking: libsctp-dev 1.0.21+dfsg-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms