class IO::Endpoint::Generic

def self.parse(string, **options)

Other tags:
    See: Endpoint.unix - unix - invoked when parsing a URL with the unix scheme: "unix://127.0.0.1"
    See: Endpoint.udp - udp - invoked when parsing a URL with the udp scheme: "udp://127.0.0.1"
    See: Endpoint.tcp - tcp - invoked when parsing a URL with the tcp scheme: "tcp://127.0.0.1"
    See: Endpoint.ssl - ssl - invoked when parsing a URL with the ssl scheme "ssl://127.0.0.1"

Parameters:
  • options () -- keyword arguments passed through to {#initialize}
  • string (String) -- URI as string. Scheme will decide implementation used.
def self.parse(string, **options)
	uri = URI.parse(string)
	
	IO::Endpoint.public_send(uri.scheme, uri.host, uri.port, **options)
end

def accept(wrapper = Wrapper.default, &block)

@yields [Socket] The accepted socket.
@parameter wrapper [Wrapper] The wrapper to use for accepting connections.
Bind and accept connections on the given address.
def accept(wrapper = Wrapper.default, &block)
	bind(wrapper) do |server|
		wrapper.accept(server, **@options, &block)
	end
end

def bind(wrapper = Wrapper.default, &block)

@returns [Array(Socket)] the bound socket
@parameter socket [Socket] The socket which has been bound.
@yields {|socket| ...} An optional block which will be passed the socket.
@parameter wrapper [Wrapper] The wrapper to use for binding.
Bind a socket to the given address. If a block is given, the socket will be automatically closed when the block exits.
def bind(wrapper = Wrapper.default, &block)
	raise NotImplementedError
end

def bound(**options)

def bound(**options)
	BoundEndpoint.bound(self, **options)
end

def connect(wrapper = Wrapper.default, &block)

Returns:
  • (Socket) - the connected socket
def connect(wrapper = Wrapper.default, &block)
	raise NotImplementedError
end

def connected(**options)

def connected(**options)
	ConnectedEndpoint.connected(self, **options)
end

def each

@parameter endpoint [Endpoint] The endpoint.
@yields {|endpoint| ...} A block which will be passed each endpoint.
Enumerate all discrete paths as endpoints.
def each
	return to_enum unless block_given?
	
	yield self
end

def hostname

Returns:
  • (String) - The hostname of the bound socket.
def hostname
	@options[:hostname]
end

def initialize(**options)

def initialize(**options)
	@options = options.freeze
end

def linger

Returns:
  • (Integer, nil) - The value for SO_LINGER.
def linger
	@options[:linger]
end

def local_address

Returns:
  • (Address) - the address to bind to before connecting.
def local_address
	@options[:local_address]
end

def reuse_address?

Returns:
  • (Boolean) - The value for `SO_REUSEADDR`.
def reuse_address?
	@options[:reuse_address]
end

def reuse_port?

Returns:
  • (Boolean, nil) - The value for `SO_REUSEPORT`.
def reuse_port?
	@options[:reuse_port]
end

def timeout

Returns:
  • (Numeric) - The default timeout for socket operations.
def timeout
	@options[:timeout]
end

def with(**options)

def with(**options)
	dup = self.dup
	
	dup.options = @options.merge(options)
	
	return dup
end