Sha256: 537b185900cde28b4808cb3fbfc9adf1331b0d709874412fe291854dbe56f41e

Contents?: true

Size: 680 Bytes

Versions: 2

Compression:

Stored size: 680 Bytes

Contents

module Thin
  module Backends
    # Connectior to act as a TCP socket server.
    class TcpServer < Base
      # Address and port on which the server is listening for connections.
      attr_accessor :host, :port
      
      def initialize(host, port)
        @host = host
        @port = port
        super()
      end
      
      # Connect the server
      def connect
        @signature = EventMachine.start_server(@host, @port, Connection, &method(:initialize_connection))
      end
      
      # Stops the server
      def disconnect
        EventMachine.stop_server(@signature)
      end
            
      def to_s
        "#{@host}:#{@port}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thin-0.7.1 lib/thin/backends/tcp_server.rb
thin-0.7.1-x86-mswin32-60 lib/thin/backends/tcp_server.rb