るりまサーチ

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

別のキーワード

  1. fileutils cp
  2. fileutils cp_r
  3. win32ole cp_acp
  4. win32ole cp_utf7
  5. win32ole cp_utf8

ライブラリ

キーワード

検索結果

TCPServer (6001.0)

TCP/IP ストリーム型接続のサーバ側のソケットのクラスです。

...TCP/IP ストリーム型接続のサーバ側のソケットのクラスです。

このクラスによって簡単にソケットを利用したサーバのプログラミングができます。

例えば echo サーバは以下のようになります。

require "socket"

gs = TCPServer...
...s.gets
s.write(str)
end
end
end
end

Thread を使えばもっと短くなります。

require "socket"

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| #...

TCPSocket (6001.0)

インターネットドメインのストリーム型ソケットのクラスです。

...をそのままサーバに転送するプログラムは以下の
ようになります。

require "socket"

port = if ARGV.size > 0 then ARGV.shift else 4444 end
print port, "\n"

s = TCPSocket.open("localhost", port)

while gets
s.write($_)
print(s.gets)
end
s.close...

Encoding::InvalidByteSequenceError (7.0)

文字列がそのエンコーディングにおいて不正なバイト列である場合に発生 する例外。

...である場合に発生
する例外。

通常エンコーディング変換時に発生します。

//emlist[例][ruby]{
"\x82\xa0".force_encoding("cp932").encode("UTF-8")
#=> "あ"
"\x82\xa0".force_encoding("EUC-JP").encode("UTF-8")
#=> Encoding::InvalidByteSequenceError: "\x82" on EUC-JP
//}...