Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Addrinfo#inspect_sockaddr

addrinfo.inspect_sockaddr => string

returns a string which shows the sockaddr in addrinfo with human-readable form.

Example
Addrinfo.tcp("localhost", 80).inspect_sockaddr     #=> "127.0.0.1:80"
Addrinfo.tcp("ip6-localhost", 80).inspect_sockaddr #=> "[::1]:80"
Addrinfo.unix("/tmp/sock").inspect_sockaddr        #=> "/tmp/sock"
See also #inspect #ip? #getnameinfo #ip_address also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0