33件ヒット
[1-33件を表示]
(0.051秒)
検索結果
-
IO
# eof? -> bool (15137.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...e
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。
r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof?... -
IO
# eof -> bool (37.0) -
ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。
...e
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。
r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。
r, w = IO.pipe
r.eof? # 永久にブロックします。
eof, eof?... -
TCPServer (18.0)
-
TCP/IP ストリーム型接続のサーバ側のソケットのクラスです。
...print(s, " is accepted\n")
else
if s.eof?
print(s, " is gone\n")
s.close
socks.delete(s)
else
str = s.gets
s.write(str)
end
end
end
end
Thread を使えばもっと短くなります。
require "so......cket"
gs = TCPServer.open(0)
addr = gs.addr
addr.shift
printf("server is on %s\n", addr.join(":"))
while true
Thread.start(gs.accept) do |s| # save to dynamic variable
print(s, " is accepted\n")
while s.gets
s.write($_)
end
print(s, " is gone...