るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.185秒)

別のキーワード

  1. _builtin constants
  2. module constants
  3. constants nonblock
  4. constants so_no_check
  5. constants pf_netbios

ライブラリ

クラス

検索結果

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

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

...した後、
connect(2) を呼び出します。

引数、返り値は Socket#connect と同じです。

connect が EINPROGRESS エラーを報告した場合、その例外(Errno::EINPROGRESS)
には IO::WaitWritable が Object#extend されます。
これを connect_nonblock をリトライす...
...Pull down Google's web page
require 'socket'
include Socket::Constants
socket = Socket.new(AF_INET, SOCK_STREAM, 0)
sockaddr = Socket.sockaddr_in(80, 'www.google.com')
begin # emulate blocking connect
socket.connect_nonblock(sockaddr)
rescue IO::WaitWritable
IO.select(nil, [sock...
...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")
results = socket.read



@param server_sockaddr 接続先アドレス
@raise Errno::EXXX connect(2) がエ...