data Socket::Address(host: String, port: Int)

A numeric address, IPv4 or IPv6, and a port.

<std:socket>:116

Methods

def host -> String

The numeric host: 127.0.0.1, ::1.

<std:socket>:118

def port -> Int

The port number.

<std:socket>:120

def with(host: String = …, port: Int = …) -> Socket::Address

A copy with the fields given replaced.

<std:socket>:123

def to_h -> Hash[Symbol, Object]

The fields as a Hash, by name.

<std:socket>:123

def ipv6? -> Bool

Whether the address is an IPv6 one.

<std:socket>:123

def to_s -> String

The address and port as 127.0.0.1:80, an IPv6 address in brackets.

Socket::Address.new("127.0.0.1", 80).to_s   # => "127.0.0.1:80"
Socket::Address.new("::1", 8080).to_s       # => "[::1]:8080"

<std:socket>:130