Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 6c03bcc36c
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (36 sloc) 0.682 kB
require 'rubygems'
require 'bundler/setup'
require 'uvrb'
loop = UV::Loop.default
server = loop.tcp
server.bind("0.0.0.0", 10000)
server.listen(128) do |err|
if err
p err
end
client = server.accept
client.start_read do |err, data|
puts data
if err
p err
client.close {}
end
client.stop_read
client.write("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 12\r\n\r\nhello world\n") do |err|
if err
p err
end
client.close {}
end
end
end
stoper = loop.timer
stoper.start(50000, 0) do |e|
puts "50 seconds passed"
server.close {}
stoper.close {}
if e
raise e
end
end
loop.run
Jump to Line
Something went wrong with that request. Please try again.