class IO::Endpoint::BoundEndpoint

def self.bound(endpoint, backlog: Socket::SOMAXCONN, close_on_exec: false)

def self.bound(endpoint, backlog: Socket::SOMAXCONN, close_on_exec: false)
	sockets = endpoint.bind
	
	sockets.each do |server|
		# This is somewhat optional. We want to have a generic interface as much as possible so that users of this interface can just call it without knowing a lot of internal details. Therefore, we ignore errors here if it's because the underlying socket does not support the operation.
		begin
			server.listen(backlog)
		rescue Errno::EOPNOTSUPP
			# Ignore.
		end
		
		server.close_on_exec = close_on_exec
	end
	
	return self.new(endpoint, sockets, **endpoint.options)
end