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

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

ファイルを追加、更新。

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby
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.