Sha256: 6dadae78d03a6343bcf23d05479002beab978c07715ae163b2a6be5e1871c3e7

Contents?: true

Size: 608 Bytes

Versions: 12

Compression:

Stored size: 608 Bytes

Contents

require 'eventmachine'
require 'r_socks/connection_handler'
require 'r_socks/config'

module RSocks
  class TcpServer

    attr_reader :config

    def initialize(host = '127.0.0.1', port = 8081)
      @host = host
      @port = port
      @config = RSocks::Config.new
    end

    def run!
      begin
        start_tcp_server
      rescue Interrupt
        puts ""
        puts "RSocks TPC server closed now...."
      end
    end

    private

    def start_tcp_server
      EventMachine.run do
        EventMachine.start_server @host, @port, RSocks::ConnectionHandler, @config
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
r_socks-0.2.3 lib/r_socks/tcp_server.rb
r_socks-0.2.2 lib/r_socks/tcp_server.rb
r_socks-0.2.1 lib/r_socks/tcp_server.rb
r_socks-0.2.0 lib/r_socks/tcp_server.rb
r_socks-0.1.8 lib/r_socks/tcp_server.rb
r_socks-0.1.7 lib/r_socks/tcp_server.rb
r_socks-0.1.6 lib/r_socks/tcp_server.rb
r_socks-0.1.5 lib/r_socks/tcp_server.rb
r_socks-0.1.4 lib/r_socks/tcp_server.rb
r_socks-0.1.3 lib/r_socks/tcp_server.rb
r_socks-0.1.2 lib/r_socks/tcp_server.rb
r_socks-0.1.1 lib/r_socks/tcp_server.rb