source: EcnlProtoTool/trunk/prototool/src/echo_client.rb@ 321

Last change on this file since 321 was 321, checked in by coas-nagasima, 7 years ago

文字コードを設定

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby;charset=UTF-8
File size: 344 bytes
Line 
1
2host = if ARGV[0] then ARGV[0] else 'localhost' end
3port = if ARGV[1] then ARGV[1] else 'echo' end
4sock = TCPSocket.open(host, port)
5
6while msg = STDIN.gets
7 print("you writed:", msg)
8 #socketに書き込む
9 sock.write(msg)
10 #サーバから返ってきたメッセージを表示する。
11 print("return message:", sock.gets)
12end
13sock.close
Note: See TracBrowser for help on using the repository browser.