source:
EcnlProtoTool/trunk/prototool/src/echo_server.rb@
279
Last change on this file since 279 was 279, checked in by , 7 years ago | |
---|---|
|
|
File size: 186 bytes |
Rev | Line | |
---|---|---|
[279] | 1 | |
2 | port = if ARGV[0] then ARGV[0] else 'echo' end | |
3 | gate = TCPServer.open(port) | |
4 | ||
5 | sock = gate.accept | |
6 | gate.close | |
7 | ||
8 | while msg = sock.gets | |
9 | sock.write(msg) | |
10 | print("you get:", msg) | |
11 | end | |
12 | sock.close |
Note:
See TracBrowser
for help on using the repository browser.