SCTP_RECVMSG(3)
π SCTP_RECVMSG π
okay bestie, welcome to sctp_recvmsg(3) β it's a Linux Programmer's Manual page and it's literally the moment your SCTP socket finally gets to receive. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
sctp_recvmsg β Receive a message from a SCTP socket.
like. the whole vibe. it gets a message. from an SCTP socket. iconic behavior honestly π
π¦ SYNOPSIS π¦
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_recvmsg(int sd, void * msg, size_t len,
struct sockaddr * from, socklen_t * fromlen,
struct sctp_sndrcvinfo * sinfo, int * msg_flags);
there it is, no cap. that's the signature, copy it exactly, don't freestyle it π
πΈ DESCRIPTION πΈ
so sctp_recvmsg is a wrapper library function β that's the key detail, it's a glow-up around the regular stuff β and you use it to receive a message from a socket while still getting all the advanced features of SCTP. the way that it gives you the fancy SCTP lore AND the message?? obsessed.
sd is the socket descriptor, and the message pointed to by msg with length len gets received on it. simple. slay.
now if from is not NULL, the source address of the message gets filled in for you. cute! and fromlen is a value-result parameter, which means it's a two-way street bestie β you initialize it to the size of the buffer associated with from, and then on return it's been modified to tell you the actual size of the address that got stored. she goes in one way and comes back different. main character energy fr fr β¨
sinfo is a pointer to a sctp_sndrcvinfo structure, and it gets filled in upon receipt of the message. it's giving "here's your receipt, queen."
msg_flags is a pointer to an integer that gets filled with any message flags, like MSG_NOTIFICATION or MSG_EOR. π
π¨ okay important one, listen up: the value of themsg_flagspointer should be initialized to 0 to avoid unexpected behavior. do not skip this. it's not a suggestion, it's a whole warning. alsomsg_flagsis used as an input flags argument to therecvmsgfunction, so it's not just an output situation β it's both. initialize it to 0. periodt.
π RETURN VALUE π
on success, sctp_recvmsg returns the number of bytes received, or -1 if an error occurred. that's it, that's the whole report card π
π SEE ALSO π
go read these next, bestie, they're all in the family:
sctp(7)sctp_bindx(3)sctp_connectx(3)sctp_sendmsg(3)sctp_sendv(3)sctp_send(3)sctp_peeloff(3)sctp_getpaddrs(3)sctp_getladdrs(3)sctp_opt_info(3)
aaaand that's the page!! this one comes to you from Linux 2.6, dated 2005-10-25, filed under SCTP_RECVMSG(3) β yes she's vintage, yes she still eats πβ¨π go forth and receive, you've got this π¦π π
π¦ 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