Class: Thin::Backends::TcpServer
- Defined in:
- lib/thin/backends/tcp_server.rb
Overview
Backend to act as a TCP socket server.
Instance Attribute Summary collapse
-
#host ⇒ Object
Address and port on which the server is listening for connections.
-
#port ⇒ Object
Address and port on which the server is listening for connections.
Attributes inherited from Base
#maximum_connections, #maximum_persistent_connections, #no_epoll, #persistent_connection_count, #server, #ssl, #ssl_options, #threaded, #timeout
Instance Method Summary collapse
-
#connect ⇒ Object
Connect the server.
-
#disconnect ⇒ Object
Stops the server.
-
#initialize(host, port) ⇒ TcpServer
constructor
A new instance of TcpServer.
- #to_s ⇒ Object
Methods inherited from Base
#close, #config, #connection_finished, #connections_list, #empty?, #running?, #size, #ssl?, #start, #stop, #stop!, #threaded?
Constructor Details
#initialize(host, port) ⇒ TcpServer
Returns a new instance of TcpServer.
8 9 10 11 12 |
# File 'lib/thin/backends/tcp_server.rb', line 8 def initialize(host, port) @host = host @port = port super() end |
Instance Attribute Details
#host ⇒ Object
Address and port on which the server is listening for connections.
6 7 8 |
# File 'lib/thin/backends/tcp_server.rb', line 6 def host @host end |
#port ⇒ Object
Address and port on which the server is listening for connections.
6 7 8 |
# File 'lib/thin/backends/tcp_server.rb', line 6 def port @port end |
Instance Method Details
#connect ⇒ Object
Connect the server
15 16 17 |
# File 'lib/thin/backends/tcp_server.rb', line 15 def connect @signature = EventMachine.start_server(@host, @port, Connection, &method(:initialize_connection)) end |
#disconnect ⇒ Object
Stops the server
20 21 22 |
# File 'lib/thin/backends/tcp_server.rb', line 20 def disconnect EventMachine.stop_server(@signature) end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/thin/backends/tcp_server.rb', line 24 def to_s "#{@host}:#{@port}" end |