Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OpenSSL::SSL::SSLSocket#accept_nonblock

ssl.accept_nonblock([options]) => self

Initiates the SSL/TLS handshake as a server in non-blocking manner.

Example
# emulates blocking accept
begin
  ssl.accept_nonblock
rescue IO::WaitReadable
  IO.select([s2])
  retry
rescue IO::WaitWritable
  IO.select(nil, [s2])
  retry
end

By specifying a keyword argument exception to false, you can indicate that accept_nonblock should not raise an IO::WaitReadable or IO::WaitWritable exception, but return the symbol :wait_readable or :wait_writable instead.

See also #accept #alpn_protocol .open #cert also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1