Ruby 从 TCP 服务器上接收数据

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

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