connect to Ruby's Web server : TCPSocket « Network « Ruby






connect to Ruby's Web server


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

 








Related examples in the same category

1.Read from a tcp server
2.Open a socket to host and port Read lines from the socket