Ruby 连接到 TCP 服务器并读取回应

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

require 'net/telnet'

server = Net::Telnet::new('Host' => 'http://www.rubyinside.com/',
                          'Port' => 80,
                          'Telnetmode' => false)

server.cmd("GET / HTTP/1.1\nHost: http://www.rubyinside.com/\n") do |response|
  puts response
end