SCTP_RECVV(3)
π SCTP_RECVV π
okay bestie, we're in the Linux manual section 3 today, and the star of the show is sctp_recvv β say it with me, "ess-see-tee-pee recv vee" π
β¨ NAME β¨
sctp_recvv β Receive a message from a SCTP socket with an extensible way.
like, she's the fancy flexible version of receiving. slay.
πΈ SYNOPSIS πΈ
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
int sctp_recvv(int sd, const struct iovec * iov, int iovlen,
struct sockaddr * from, socklen_t * fromlen, void * info,
socklen_t * infolen, unsigned int * infotype, int * flags);
copy that exactly, no typos, i'm watching π
π¦ DESCRIPTION π¦
okay so sctp_recvv is literally giving the SCTP stack an extensible way to pass up all the different SCTP attributes that come with a received message, straight to your application. iconic behavior honestly.
there are two types of attributes that can come back from this call:
- the attribute of the received message, and
- the attribute of the next message in the receive buffer.
you, the caller, enable the SCTP_RECVRCVINFO and SCTP_RECVNXTINFO socket options respectively to get these attributes. β¨
- attributes of the received message come back in
struct sctp_rcvinfo - attributes of the next message come back in
struct sctp_nxtinfo
and if both options are enabled, both attributes come back using this structure right here:
struct sctp_recvv_rn {
struct sctp_rcvinfo recvv_rcvinfo;
struct sctp_nxtinfo recvv_nxtinfo;
};
no cap, that's the whole struct. π
now let's break down the args, bestie, one by one:
sdis the socket descriptor. your little connection passport π«Άiovis the scatter buffer, and only one user message is returned in this buffer. just the one, don't get greedy.iovlenis the number of elements iniov.fromis a pointer to a buffer that gets filled with the sender of the received message's address. so you know who's talking to you πfromlenis an in/out parameter describing thefromlength.infois a pointer to the buffer that holds the attributes of the received message, and the structure type ofinfois determined by theinfo_typeparameter.infolenis an in/out parameter describing the size of theinfobuffer.- on return,
infotypeis set to the type of theinfobuffer, and the currently defined values are... drumroll please π₯
π the infotype values π
SCTP_RECVV_NOINFOβ if neitherSCTP_RECVRCVINFOnorSCTP_RECVNXTINFOoptions are enabled, no attribute comes back at all. and if only theSCTP_RECVNXTINFOoption is enabled but there's no next message in the buffer, again, no attribute comes back. in these cases,*info_typegets set toSCTP_RECVV_NOINFO. it's giving "nothing to see here" πSCTP_RECVV_RCVINFOβ the type ofinfoisstruct sctp_rcvinfo, and the attribute relates to the received message. πSCTP_RECVV_NXTINFOβ the type ofinfoisstruct sctp_nxtinfo, and the attribute relates to the next message in the receive buffer. this is the case when only theSCTP_RECVNXTINFOoption is enabled and there is a next message in the buffer. peek-a-boo πSCTP_RECVV_RNβ the type ofinfoisstruct sctp_recvv_rn. therecvv_rcvinfofield is the attribute of the received message, and therecvv_nxtinfofield is the attribute of the next message in the buffer. this is the case when bothSCTP_RECVRCVINFOandSCTP_RECVNXTINFOoptions are enabled and there's a next message in the receive buffer. best of both worlds, we love a combo π
and last but not least:
flagsis a pointer to an integer to be filled with any message flags (e.g.,MSG_NOTIFICATION). π¬
β RETURN VALUE β
on success, sctp_recvv returns the number of bytes received, or -1 if an error occurred. that's it, that's the whole vibe check. π
π SEE ALSO π
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)
go read those too, bestie, knowledge is free π
π§ little sign-off from your favorite Unix girlie: this page is from Linux 4.16, dated 2018-04-29, and it's SCTP_RECVV(3) β periodt. now go receive some messages, 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