class GQTP::Backend::Thread::Server

Attributes

host[RW]
port[RW]

Public Class Methods

new(options={}) click to toggle source
# File lib/gqtp/backend/thread.rb, line 99
def initialize(options={})
  @options = options
  @host = options[:host] || "0.0.0.0"
  @port = options[:port] || 10043
  @backlog = options[:backlog] || 128
end

Public Instance Methods

run() { |io| ... } click to toggle source
# File lib/gqtp/backend/thread.rb, line 106
def run
  @server = TCPServer.new(@host, @port)
  @server.listen(@backlog)
  thread = ::Thread.new do
    loop do
      client = @server.accept
      ::Thread.new do
        yield(IO.new(client))
      end
    end
  end
  Request.new(thread)
end
shutdown() click to toggle source
# File lib/gqtp/backend/thread.rb, line 120
def shutdown
  @server.shutdown
end