SOCKET_...DDRINFO(1p)

πŸ“¦
version 0.22 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ SOCKET_...DDRINFO(1p) ✨

okay so bestie, welcome to the User Contributed Perl Documentation page for socket_getaddrinfo β€” manual section 1p, she's iconic, she's a little niche, and she is about to become your new hyperfixation πŸ’…


πŸŽ€ NAME πŸŽ€

socket_getaddrinfo β€” a command-line tool for the getaddrinfo(3) resolver 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

socket_getaddrinfo [options...] host service

πŸ’– DESCRIPTION πŸ’–

So basically this tool is a convenient command-line wrapper around the getaddrinfo(3) resolver function. It does one single lookup β€” just the one, no cap β€” and then prints the results it got back in a human-readable form. 🫢

The way this is mainly useful is when you're debugging address resolution problems, because it lets you peek directly at the behaviour of getaddrinfo(3) itself, outside of any real program that's actually trying to use it. Like, you're not fighting some app's weird little quirks, you're just vibing with the resolver one-on-one. 🧚


πŸ‘‘ OPTIONS πŸ‘‘

  • --host, -H HOST β€” the hostname to resolve. If you don't supply it, it'll use the first positional argument instead. ✨
  • --service, -S SERVICE β€” the service name or port number to resolve. If you don't supply it, it'll use the second positional argument instead. 🌸
  • -4 β€” restrict to just AF_INET (IPv4) results. old school, but make it fashion πŸ’…
  • -6 β€” restrict to just AF_INET6 (IPv6) results. the future is now, bestie 🌈
  • --stream β€” restrict to just SOCK_STREAM results. πŸ”₯
  • --dgram β€” restrict to just SOCK_DGRAM results. πŸ’Œ
  • --proto PROTO β€” restrict to just results of the given IP protocol. 🎯
  • --passive β€” set the AI_PASSIVE hint; results will used to bind() and listen() rather than connect(). she's giving server energy, not client energy, periodt πŸ‘‘
  • --canonical β€” retrieve the canonical name for the requested host. ⭐
  • --help β€” display a help summary and exit. the classic escape hatch πŸ™ˆ

πŸ“ OUTPUT FORMAT πŸ“

Every single line of output comes in a form that shows off the four result fields: ai_family, ai_socktype, ai_protocol and ai_addr. 🌟

The first three get printed in the form of a socket(2) call β€” either symbolically or numerically, dealer's choice β€” and then the last one (ai_addr) gets printed as a plain string following it. Like so:

 socket(AF_INET , SOCK_STREAM, IPPROTO_TCP) + '127.0.0.1:80'

πŸ’€ NOTE πŸ’€

Upstream, this script is known as getaddrinfo, but it was renamed on Debian. so if you go looking for her under her government name, that's why you can't find her 😭


πŸ’œ AUTHOR πŸ’œ

Paul Evans <leonerd@leonerd.org.uk> 🫢


and that's the whole page, bestie! this was brought to you by perl v5.40.0, dated 2025-02-01, and if you ever need to find it again it lives under SOCKET_...DDRINFO(1p). go forth and debug your resolution problems, you absolute main character πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from