Class: RSocks::TcpServer

Inherits:
Object
  • Object
show all
Defined in:
lib/r_socks/tcp_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host = '127.0.0.1', port = 8081) ⇒ TcpServer

Returns a new instance of TcpServer.



10
11
12
13
14
# File 'lib/r_socks/tcp_server.rb', line 10

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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/r_socks/tcp_server.rb', line 8

def config
  @config
end

Instance Method Details

#run!Object



16
17
18
19
20
21
22
# File 'lib/r_socks/tcp_server.rb', line 16

def run!
  begin
    start_tcp_server
  rescue Interrupt
    puts "\nr_socks TPC main server closed now...."
  end
end