Class: Rev::TCPServer
- Defined in:
- lib/rev/server.rb
Overview
TCP server class. Listens on the specified host and port and creates new connection objects of the given class. This is the most common server class. Note that the new connection objects will be bound by default to the same event loop that the server is attached to.
Instance Method Summary collapse
-
#initialize(host, port, klass = TCPSocket, *args, &block) ⇒ TCPServer
constructor
A new instance of TCPServer.
Methods inherited from Listener
Methods inherited from IOWatcher
#attach, #detach, #disable, #enable, #on_readable, #on_writable
Methods included from Meta
#event_callback, #watcher_delegate
Methods inherited from Watcher
#attach, #attached?, #detach, #disable, #enable, #enabled?, #evloop
Constructor Details
#initialize(host, port, klass = TCPSocket, *args, &block) ⇒ TCPServer
Returns a new instance of TCPServer.
45 46 47 48 49 |
# File 'lib/rev/server.rb', line 45 def initialize(host, port, klass = TCPSocket, *args, &block) listen_socket = ::TCPServer.new(host, port) listen_socket.instance_eval { listen(1024) } # Change listen backlog to 1024 super(listen_socket, klass, *args, &block) end |