Class: UState::Server::Backends::TCP
- Defined in:
- lib/ustate/server/backends/tcp.rb
Constant Summary collapse
- HOST =
'127.0.0.1'
- PORT =
55956
Constants inherited from Base
Base::MAXIMUM_CONNECTIONS, Base::MAX_CONNECTIONS, Base::TIMEOUT
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
Attributes inherited from Base
#maximum_connections, #server, #ssl, #ssl_options, #timeout
Instance Method Summary collapse
-
#connect ⇒ Object
Connect the server.
-
#disconnect ⇒ Object
Stops server.
-
#initialize(opts = {}) ⇒ TCP
constructor
A new instance of TCP.
- #to_s ⇒ Object
Methods inherited from Base
#close, #config, #connection_finished, #empty?, #running?, #size, #ssl?, #start, #stop, #stop!
Constructor Details
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/ustate/server/backends/tcp.rb', line 7 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/ustate/server/backends/tcp.rb', line 7 def port @port end |
Instance Method Details
#connect ⇒ Object
Connect the server
19 20 21 22 |
# File 'lib/ustate/server/backends/tcp.rb', line 19 def connect @server.log.info "Listening on #{@host}:#{@port}" @signature = EventMachine.start_server(@host, @port, Connection, &method(:initialize_connection)) end |
#disconnect ⇒ Object
Stops server
25 26 27 |
# File 'lib/ustate/server/backends/tcp.rb', line 25 def disconnect EventMachine.stop_server @signature end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/ustate/server/backends/tcp.rb', line 29 def to_s "#{@host}:#{@port}" end |