addr(*args) public

Returns the local address as an array which contains address_family, port, hostname and numeric_address.

If reverse_lookup is true or :hostname, hostname is obtained from numeric_address using reverse lookup. Or if it is false, or :numeric, hostname is same as numeric_address. Or if it is nil or omitted, obeys to ipsocket.do_not_reverse_lookup. See Socket.getaddrinfo also."", 80) {|sock|
  p sock.addr #=> ["AF_INET", 49429, "hal", ""]
  p sock.addr(true)  #=> ["AF_INET", 49429, "hal", ""]
  p sock.addr(false) #=> ["AF_INET", 49429, "", ""]
  p sock.addr(:hostname)  #=> ["AF_INET", 49429, "hal", ""]
  p sock.addr(:numeric)   #=> ["AF_INET", 49429, "", ""]
Show source
Register or log in to add new notes.