SCTP_SENDV(3)

πŸ“¦
version 1.0.21 Β· 2 versions
  • 1.0.21 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 15.1 Β· freebsd 15.1
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’Œ SCTP_SENDV(3) β€” the Linux manual page, but make it make sense

okay bestie, gather round, because we're talking about sctp_sendv β€” the Linux man page, third section, and honestly? she's iconic. this is the send call that lets you send SCTP messages in an extensible way. no cap.


✨ NAME ✨

sctp_sendv β€” Send messages from a SCTP socket with an extensible way. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>

int sctp_sendv(int sd, const struct iovec * iov, int iovcnt,
               struct sockaddr *addrs, int addrcnt, void * info,
               socklen_t infolen, unsigned int infotype, int flags);

like. look at all those params. she's doing the MOST and we love her for it. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie: sctp_sendv gives your application an extensible way to communicate allllll kinds of different send attributes to the SCTP stack when it sends a message. it's giving "I have options and I'm not afraid to use them" energy. πŸ’…

there are three types of attributes you can use to describe a message to be sent. they are:

  • struct sctp_sndinfo
  • struct sctp_prinfo
  • struct sctp_authinfo

and because sometimes ONE attribute just isn't enough (relatable), the following structure, sctp_sendv_spa, is defined to be used when more than one of the above attributes are needed to describe a message to be sent:

struct sctp_sendv_spa {
  uint32_t sendv_flags;
  struct sctp_sndinfo sendv_sndinfo;
  struct sctp_prinfo sendv_prinfo;
  struct sctp_authinfo sendv_authinfo;
};

the sendv_flags field holds a bitwise OR of SCTP_SEND_SNDINFO_VALID, SCTP_SEND_PRINFO_VALID, and SCTP_SEND_AUTHINFO_VALID, and it's basically telling everyone whether the sendv_sndinfo / sendv_prinfo / sendv_authinfo fields actually contain valid information. it's a vibe check for your structs, fr fr. βœ…

now let's meet the cast of parameters, one by one, because they all matter:

  • sd β€” the socket descriptor. that's your girl. πŸ”Œ
  • iov β€” the gather buffer. the data in the buffer is treated as a single user message. one message, many buffers, she contains multitudes. ✨
  • iovcnt β€” the number of elements in iov.
  • addrs β€” an array of addresses to be used to set up an association, or a single address to be used to send the message. and you pass in NULL if the caller neither wants to set up an association nor wants to send the message to a specific address. no addrs, no problem.
  • addrcnt β€” the number of addresses in the addrs array.
  • info β€” a pointer to the buffer containing the attribute associated with the message to be sent. the type is indicated by the info_type parameter. πŸ“Ž
  • infolen β€” the length of info, in bytes.
  • infotype β€” identifies the type of the information provided in info. and the current defined values are as follows, bestie, get your notes app out:
  • SCTP_SENDV_NOINFO β€” No information is provided. The parameter info is a NULL pointer, and infolen is 0. it's giving minimalism. πŸ’€
  • SCTP_SENDV_SNDINFO β€” The parameter info is pointing to a struct sctp_sndinfo.
  • SCTP_SENDV_PRINFO β€” The parameter info is pointing to a struct sctp_prinfo.
  • SCTP_SENDV_AUTHINFO β€” The parameter info is pointing to a struct sctp_authinfo.
  • SCTP_SENDV_SPA β€” The parameter info is pointing to a struct sctp_sendv_spa. (that's the combo platter one πŸ“)
  • flags β€” The same flags as used by the sendmsg() call flags (e.g., MSG_DONTROUTE).
🫢 friendly reminder: addrs can be NULL, and if you're going the SCTP_SENDV_NOINFO route then info is NULL and infolen is 0. don't be out here passing random garbage, the stack will simply not be charmed.

🌸 RETURN VALUE 🌸

On success, sctp_sendv returns the number of bytes sent ✨ or -1 if an error occurred. 😭


πŸ’– SEE ALSO πŸ’–

go read these too, they're all part of the same friend group:

sctp(7), sctp_bindx(3), sctp_connectx(3), sctp_send(3), sctp_recvmsg(3), sctp_recvv(3), sctp_peeloff(3), sctp_getpaddrs(3), sctp_getladdrs(3), sctp_opt_info(3)


okay that's the whole page, you ate it, periodt πŸ‘‘

this one's from Linux 4.16, dated 2018-04-29 β€” so yeah, vintage but still serving. mwah πŸ’‹ go send some messages bestie, i believe in you πŸ¦‹

πŸ“¦ where this page comes from