分享至
朋友圈
微信
qq空间
qq
微博
复制
require 'socket' host = "localhost" port = 12345 TCPSocket.open(host, port) do |s| # Use block form of open while line = s.gets puts line.chop end end