-
[原创]Ruby最简单的消息办事器
添加时间:2013-6-7 点击量:ser.rb
require socket
s = TCPServer.new 3333
conn = s.accept
loop do
puts conn.gets
endclt.rb
require socket
s = TCPSocket.new localhost,3333
loop do
sms=gets.chomp
s.puts sms
end
ser.rb
require socket
s = TCPServer.new 3333
conn = s.accept
loop do
puts conn.gets
end
clt.rb
require socket
s = TCPSocket.new localhost,3333
loop do
sms=gets.chomp
s.puts sms
end