source: EcnlProtoTool/trunk/prototool/src/echo_server.rb

Last change on this file 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: 186 bytes
Line 
1
2port = if ARGV[0] then ARGV[0] else 'echo' end
3gate = TCPServer.open(port)
4
5sock = gate.accept
6gate.close
7
8while msg = sock.gets
9 sock.write(msg)
10 print("you get:", msg)
11end
12sock.close
Note: See TracBrowser for help on using the repository browser.