Method: UNIXServer#accept_nonblock
- Defined in:
- socket.c
#accept_nonblock ⇒ Object
Accepts an incoming connection using accept(2) after O_NONBLOCK is set for the underlying file descriptor. It returns an accepted UNIXSocket for the incoming connection.
Example
require ‘socket’ serv = UNIXServer.new(“/tmp/sock”) begin sock = serv.accept_nonblock rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR IO.select([serv]) retry end # sock is an accepted socket.
Refer to Socket#accept for the exceptions that may be thrown if the call to UNIXServer#accept_nonblock fails.
UNIXServer#accept_nonblock may raise any error corresponding to accept(2) failure, including Errno::EAGAIN.
See
-
UNIXServer#accept
-
Socket#accept
2174 2175 2176 |
# File 'socket.c', line 2174 static VALUE unix_accept_nonblock(sock) VALUE sock; |