Sha256: b1c4ac045204703489e6a5560971f7220b66f3abbba932782ac80e44e5013079

Contents?: true

Size: 384 Bytes

Versions: 2

Compression:

Stored size: 384 Bytes

Contents

#!/usr/bin/env ruby

$: << File.join(File.dirname(__FILE__), '..', 'lib')

require 'net/socket'

include Net::Socket

async  = !!ARGV.delete('--async')

uri = URI.parse('http://da.gd/ip')
socket = TCP::Client.new(uri.host, uri.port)

socket.puts "GET #{uri.path} HTTP/1.1"
socket.puts "Host: #{uri.host}"
socket.puts "Accept: text/plain"
socket.puts ""

puts socket.read
socket.close

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
net-socket-1.0.1 examples/http-client.rb
net-socket-1.0.0 examples/http-client.rb