Skip to content
class method

Socket.accept_loop

(*::_ToIO sockets) { (::Socket) -> void } -> void
accept_loop(*sockets) { |socket, client_addrinfo| ... }

yield socket and client address for each a connection accepted via given sockets.

The arguments are a list of sockets. The individual argument should be a socket or an array of sockets.

This method yields the block sequentially. It means that the next connection is not accepted until the block returns. So concurrent mechanism, thread for example, should be used to service multiple clients at a time.

See also .getaddrinfo .gethostbyaddr also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0