るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

検索結果

UDPSocket#recvfrom_nonblock(maxlen, flags=0) -> [String, Array] (207.0)

ソケットをノンブロッキングモードに設定した後、 recvfrom(2) でソケットからデータを受け取ります。

...quire 'socket'
s1 = UDPSocket.new
s1.bind("127.0.0.1", 0)
s2 = UDPSocket.new
s2.bind("127.0.0.1", 0)
s2.connect(*s1.addr.values_at(3,1))
s1.connect(*s2.addr.values_at(3,1))
s1.send "aaa", 0
begin # emulate blocking recvfrom
p s2.recvfrom_nonblock(10)
#=> ["aaa", ["AF_INET",...
...33302, "localhost.localdomain", "127.0.0.1"]]
rescue IO::WaitReadable
IO.select([s2])
retry

end

@param maxlen 受け取るデータの最大バイト数
@param flags フラグ
@see IPSocket#recvfrom...