るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.021秒)
トップページ > クエリ:select[x] > クエリ:get[x] > クエリ:connect_nonblock[x]

別のキーワード

  1. tracer set_get_line_procs
  2. webrick/httpservlet do_get
  3. net/http get
  4. http get
  5. tracer get_thread_no

ライブラリ

クラス

検索結果

Socket#connect_nonblock(server_sockaddr) -> 0 (18131.0)

ソケットをノンブロッキングモードに設定した後、 connect(2) を呼び出します。

...PROGRESS エラーを報告した場合、その例外(Errno::EINPROGRESS)
には IO::WaitWritable が Object#extend されます。
これを connect_nonblock をリトライするために使うことができます。

# Pull down Google's web page
require 'socket'
include Socket::Constants...
...king connect
socket.connect_nonblock(sockaddr)
rescue IO::WaitWritable
IO.select(nil, [socket]) # wait 3-way handshake completion
begin
socket.connect_nonblock(sockaddr) # check connection failure
rescue Errno::EISCONN
end
end
socket.write("GET / HTTP/1.0\r\n\r\n")...