Sha256: d56ce7eae30287df3f0cad98467c6fbf6f0dd79e1f825370a4eb7a268754baaf

Contents?: true

Size: 687 Bytes

Versions: 6

Compression:

Stored size: 687 Bytes

Contents

module Thin
  module Connectors
    # Connectior to act as a TCP socket server.
    class TcpServer < Connector
      # 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

6 entries across 6 versions & 1 rubygems

Version Path
thin-0.6.4-x86-mswin32-60 lib/thin/connectors/tcp_server.rb
thin-0.7.0-x86-mswin32-60 lib/thin/connectors/tcp_server.rb
thin-0.6.4 lib/thin/connectors/tcp_server.rb
thin-0.6.3 lib/thin/connectors/tcp_server.rb
thin-0.6.3-x86-mswin32-60 lib/thin/connectors/tcp_server.rb
thin-0.7.0 lib/thin/connectors/tcp_server.rb