class Async::Socket
def self.bind(local_address, backlog: nil, protocol: 0, task: Task.current, &block)
(**protcol)
-
The
(Integer
) -- socket protocol to use.
Parameters:
-
local_address
(Addrinfo
) -- The local address to bind to.
def self.bind(local_address, backlog: nil, protocol: 0, task: Task.current, &block) socket = ::Socket.new(local_address.afamily, local_address.socktype, protocol) socket.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_REUSEADDR, true) socket.bind(local_address) socket.listen(backlog) if backlog if block_given? task.with(socket, &block) else return socket end end