SCTP_BINDX(3)

πŸ“¦
version 1.0.21 Β· 3 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)
  • 14.5 Β· freebsd 14.5
  • 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_BINDX(3) πŸ’–

okay bestie, welcome to the sctp_bindx page β€” it's from the Linux Programmer's Manual and it's literally all about adding and removing bind addresses on a socket. let's get into it πŸ¦‹


✨ NAME ✨

sctp_bindx β€” Add or remove bind addresses on a socket.


🌸 SYNOPSIS 🌸

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

int sctp_bindx(int sd, struct sockaddr * addrs, int addrcnt,
               int flags);

πŸ’… DESCRIPTION πŸ’…

so here's the tea β˜• β€” sctp_bindx adds or removes a whole set of bind addresses. the addresses come in as an array called addrs, and they get added to (or removed from) the socket sd. the addrcnt param is how many addresses are chillin' in that array, and the flags param is the vibe check that says whether we're adding or removing. no cap.

now, family matters (literally) πŸ’€ β€” if sd is an IPv4 socket, the addresses you pass must be IPv4 addresses. if sd is an IPv6 socket, then the addresses you pass can be either IPv4 or IPv6. slay, flexible queen.

addrs is a pointer to an array of one or more socket addresses. each address lives inside its own appropriate structure, i.e. struct sockaddr_in or struct sockaddr_in6. the family of the address type is what you use to figure out the address length β€” that's the key, iykyk. and the caller is the one who tells us how many addresses are in the array, via addrcnt.

the flags parameter can be either SCTP_BINDX_ADD_ADDR or SCTP_BINDX_REM_ADDR:

  • SCTP_BINDX_ADD_ADDR β€” an app can use this to associate additional addresses with an endpoint after calling bind(2). main character energy fr fr.
  • SCTP_BINDX_REM_ADDR β€” this directs SCTP to remove the given addresses from the association.
⚠️ okay important bestie: a caller may not remove all addresses from an association. it will fail with EINVAL. periodt. πŸ’€

🫢 RETURN VALUE 🫢

  • On success, 0 is returned. ✨
  • On failure, -1 is returned, and errno is set appropriately.

😭 ERRORS 😭

  • EBADF β€” sd is not a valid descriptor. not it. πŸ™ˆ
  • ENOTSOCK β€” sd is a descriptor for a file, not a socket. girl, that's a file. πŸ’€
  • EFAULT β€” Error while copying in or out from the user address space.
  • EINVAL β€” Invalid port or address, or trying to remove all addresses from an association.
  • EACCES β€” The address is protected, and the user is not the super-user. no root, no entry πŸŽ€

🌈 SEE ALSO 🌈

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


and that's the whole page, bestie πŸ’– this one's from Linux 2.6, dated 2005-10-25, and it's filed under SCTP_BINDX(3). go forth and bind responsibly, queen πŸ‘‘βœ¨

πŸ“¦ where this page comes from