repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git]
/
sample
/
clnt.rb
blob
0f3d17bf19e769e945ae166a4a3dd98a8d20ab5c
1
# socket example - client side
2
# usage: ruby clnt.rb [host] port
3
4
require "socket"
5
6
if ARGV.length >= 2
7
host = ARGV.shift
8
else
9
host = "localhost"
10
end
11
print("Trying ", host, " ...")
12
STDOUT.flush
13
s = TCPSocket.open(host, ARGV.shift)
14
print(" done\n")
15
print("addr: ", s.addr.join(":"), "\n")
16
print("peer: ", s.peeraddr.join(":"), "\n")
17
while line = gets()
18
s.write(line)
19
print(s.readline)
20
end
21
s.close