Sha256: fb0f01a70f36d891f9fed74156dea9e6ffe8d7b294481e803989498a388f4aae
Contents?: true
Size: 646 Bytes
Versions: 4
Compression:
Stored size: 646 Bytes
Contents
# Stolen from Thin class UState::Server class Backends::TCP < Backends::Base require 'socket' attr_accessor :host, :port HOST = '127.0.0.1' PORT = 55956 def initialize(opts = {}) @host = opts[:host] || HOST @port = opts[:port] || PORT super opts end # Connect the server def connect puts "Listening on #{@host}:#{@port}" @signature = EventMachine.start_server(@host, @port, Connection, &method(:initialize_connection)) end # Stops server def disconnect EventMachine.stop_server @signature end def to_s "#{@host}:#{@port}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems