KNET_ADDRTOSTR(3)

KNET_ADDRTOSTR(3) πŸ’–

okay bestie, welcome to the Kronosnet Programmer's Manual β€” this is the page for knet_addrtostr, and yes it's giving "turn a socket address into something a human can read." slay. πŸŽ€


✨ NAME ✨

knet_addrtostr β€” Convert an address to a host name.


✨ SYNOPSIS ✨

#include <libknet.h>

int knet_addrtostr(
    const struct sockaddr_storage   *ss,
    socklen_t                        sslen,
    char                            *addr_buf,
    size_t                           addr_buf_size,
    char                            *port_buf,
    size_t                           port_buf_size
);

✨ DESCRIPTION ✨

knet_addrtostr πŸ¦‹

here's the whole vibe, one argument at a time:

  • ss β€” the sockaddr_storage you wanna convert. that's it, that's the one.
  • sslen β€” the len of the sockaddr_storage. length matters, always has πŸ’…
  • host β€” the IPaddr/hostname where to store data. recommended size: KNET_MAX_HOST_LEN. (yes the manpage calls it host here even tho the synopsis says addr_buf, iykyk, they're the same little guy 🫢)
  • port β€” the port buffer where to store data. recommended size: KNET_MAX_PORT_LEN.
no cap, use those recommended sizes. KNET_MAX_HOST_LEN and KNET_MAX_PORT_LEN exist for a reason and the reason is you not overflowing a buffer. 😭

✨ RETURN VALUE ✨

ok so <cyan>knet_strtoaddr</cyan> returns the same error codes as getnameinfo. (yes bb, the page literally says knet_strtoaddr in the return value section. we are not editing the lore. πŸ“œβœ¨)


✨ SEE ALSO ✨

the whole friend group, alphabetically-ish, all of them, no one left out πŸ’–:


Copyright (C) 2010-2026 Red Hat, Inc. All rights reserved. πŸ‘‘


and that's the page, bestie!! 🌸 go forth and convert addresses, you absolute main character. 🧚

kronosnet Β· 2026-07-20 Β· KNET_ADDRTOSTR(3) πŸ’œ β€” mwah, mwah, go read the other 70-something pages, they're all in SEE ALSO, periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from