Sha256: 05ff2c1975edd9e37f5ccf37f4981c9d2c7ccf8cdda14b9190b7268e472eb047

Contents?: true

Size: 384 Bytes

Versions: 6

Compression:

Stored size: 384 Bytes

Contents

require 'socket'
require 'thread'
require 'timeout'

server = TCPServer.new(10000)
server.listen(128)

Timeout.timeout(50) do
  while(client = server.accept)
    client.puts "HTTP/1.1 200 OK\r\n"
    client.puts "Content-Type: text/plain\r\n"
    client.puts "Content-Length: 12\r\n"
    client.puts "\r\n"
    client.puts "hello world\n"
    client.close
    client = nil
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
uvrb-0.2.0 examples/tcp_example_plain.rb
uvrb-0.1.4 examples/tcp_example_plain.rb
uvrb-0.1.3 examples/tcp_example_plain.rb
uvrb-0.1.2 examples/tcp_example_plain.rb
uvrb-0.1.1 examples/tcp_example_plain.rb
uvrb-0.1.0 examples/tcp_example_plain.rb