socket_local6(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– socket_local6(3) πŸ’–

okay so bestie, this one lives in the Library Functions Manual and it's literally called socket_local6 β€” say hi πŸ‘‹


✨ NAME ✨

socket_local6 β€” get local IP address of socket 🫢


🌸 SYNTAX 🌸

#include <libowfat/socket.h>

int socket_local6(int s,char ip[16],uint16 *port,uint32 *scope_id);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, socket_local6 returns the local IPv6 address, port and scope ID for the UDP or TCP socket s, and writes stuff out like the main character it is πŸ’…:

  • the IPv6 address goes to ip
  • the port goes to port
  • the scope ID goes to scope_id

and if scope_id is the null pointer? no stress, it just discards the scope ID entirely, like it never happened πŸ™ˆ

but bestie, if something goes wrong, socket_local6 returns -1 and sets errno appropriately. so check it, fr fr. 😭

🌈 SEE ALSO 🌈


k bye ily, this was socket_local6(3) from the Library Functions Manual β€” that's the source and the whole vibe, go forth and slay βœ¨πŸ‘‘πŸ’œ