Connecting to a TCP Server Directly : Telnet « Network « Ruby






Connecting to a TCP Server Directly


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

 








Related examples in the same category

1.create your own basic client using net/telnet