[原创]Ruby最简单的消息办事器
添加时间:2013-6-7 点击量:
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
容易发怒的意思就是: 别人做了蠢事, 然后我们代替他们, 表现出笨蛋的样子。—— 蔡康永
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