- require 'socket'
- socket = TCPSocket.new("www.ruby-lang.org", 80)
- socket.puts "GET /en/index.html"
- while (line = socket.gets)
- puts line
- end
- socket.close
- #该片段来自于http://www.codesnippet.cn/detail/170120131722.html
来源: http://www.codesnippet.cn/detail/170120131722.html