Last change
on this file since 428 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 |
|
---|
2 | host = if ARGV[0] then ARGV[0] else 'localhost' end
|
---|
3 | port = if ARGV[1] then ARGV[1] else 'echo' end
|
---|
4 | sock = TCPSocket.open(host, port)
|
---|
5 |
|
---|
6 | while msg = STDIN.gets
|
---|
7 | print("you writed:", msg)
|
---|
8 | #socketに書き込む
|
---|
9 | sock.write(msg)
|
---|
10 | #サーバから返ってきたメッセージを表示する。
|
---|
11 | print("return message:", sock.gets)
|
---|
12 | end
|
---|
13 | sock.close
|
---|
Note:
See
TracBrowser
for help on using the repository browser.