Skip to content

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

instance method

Addrinfo#to_s

addrinfo.to_s => string

Alias of #to_sockaddr

returns the socket address as packed struct sockaddr string.

Example
Addrinfo.tcp("localhost", 80).to_sockaddr
#=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
See also #to_sockaddr #socktype #protocol #unix? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1