本文簡要介紹ruby語言中 OpenSSL::SSL::SSLSocket.connect_nonblock
的用法。
用法
connect_nonblock([options]) → self
作為客戶端以非阻塞方式啟動 SSL/TLS 握手。
# emulates blocking connect
begin
ssl.connect_nonblock
rescue IO::WaitReadable
IO.select([s2])
retry
rescue IO::WaitWritable
IO.select(nil, [s2])
retry
end
通過將關鍵字參數 exception
指定為 false
,您可以指示 connect_nonblock
不應引發 IO::WaitReadable
或 IO::WaitWritable
異常,而是返回符號 :wait_readable
或 :wait_writable
。
相關用法
- Ruby SSLSocket.open用法及代碼示例
- Ruby SSLSocket.accept_nonblock用法及代碼示例
- Ruby SSLContext.add_certificate用法及代碼示例
- Ruby SSLContext.renegotiation_cb用法及代碼示例
- Ruby SSLContext.alpn_select_cb用法及代碼示例
- Ruby SSLConfig.new用法及代碼示例
- Ruby SSLContext.min_version =用法及代碼示例
- Ruby SSLContext.ecdh_curves =用法及代碼示例
- Ruby SSLContext.alpn_protocols用法及代碼示例
- Ruby SSLContext.tmp_dh =用法及代碼示例
- Ruby SSLContext.npn_protocols用法及代碼示例
- Ruby SSLContext.npn_select_cb用法及代碼示例
- Ruby Symbol capitalize用法及代碼示例
- Ruby SizedQueue clear()用法及代碼示例
- Ruby Spotter.spot_op_asgn2_for_name用法及代碼示例
- Ruby StringScanner skip_until用法及代碼示例
- Ruby StringScanner search_full用法及代碼示例
- Ruby String.match?用法及代碼示例
- Ruby StringScanner.beginning_of_line?用法及代碼示例
- Ruby Stat.stat <=>用法及代碼示例
- Ruby Symbol.to_proc用法及代碼示例
- Ruby Symbol.end_with?用法及代碼示例
- Ruby StringScanner restsize用法及代碼示例
- Ruby Spotter.spot_opcall_for_name用法及代碼示例
- Ruby Set flatten()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 SSLSocket.connect_nonblock。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。