Class: Vertx::NetServer
- Inherits:
-
Object
- Object
- Vertx::NetServer
- Includes:
- SSLSupport, ServerSSLSupport, ServerTCPSupport, TCPSupport
- Defined in:
- src/main/api_shim/core/net.rb
Overview
Represents a TCP or SSL Server
When connections are accepted by the server
they are supplied to the user in the form of a NetSocket instance that is passed via the handler
set using #connect_handler.
Instance Method Summary (collapse)
-
- (Object) close(&hndlr)
Close the server.
-
- (NetServer) connect_handler(&hndlr)
Supply a connect handler for this server.
-
- (Object) host
Get the host.
-
- (NetServer) initialize
constructor
Create a new NetServer.
-
- (Object) listen(port, host = "0.0.0.0", &hndlr)
Instruct the server to listen for incoming connections.
-
- (Object) port
Get the port.
Methods included from SSLSupport
#key_store_password, #key_store_password=, #key_store_path, #key_store_path=, #ssl, #ssl=, #trust_store_password, #trust_store_password=, #trust_store_path, #trust_store_path=
Methods included from ServerSSLSupport
#client_auth_required, #client_auth_required=
Methods included from TCPSupport
#receive_buffer_size=, #reuse_address, #reuse_address=, #send_buffer_size, #send_buffer_size=, #send_receive_size, #so_linger, #so_linger=, #tcp_keep_alive, #tcp_keep_alive=, #traffic_class, #traffic_class=, #use_pooled_buffers, #use_pooled_buffers=
Methods included from ServerTCPSupport
#accept_backlog, #accept_backlog=
Constructor Details
- (NetServer) initialize
Create a new NetServer
36 37 38 |
# File 'src/main/api_shim/core/net.rb', line 36 def initialize @j_del = org.vertx.java.platform.impl.JRubyVerticleFactory.vertx.createNetServer end |
Instance Method Details
- (Object) close(&hndlr)
Close the server. The handler will be called when the close is complete.
60 61 62 |
# File 'src/main/api_shim/core/net.rb', line 60 def close(&hndlr) @j_del.close(ARWrappedHandler.new(hndlr)) end |
- (NetServer) connect_handler(&hndlr)
Supply a connect handler for this server. The server can only have at most one connect handler at any one time.
As the server accepts TCP or SSL connections it creates an instance of Vertx::NetSocket and passes it to the
connect handler.
45 46 47 48 |
# File 'src/main/api_shim/core/net.rb', line 45 def connect_handler(&hndlr) @j_del.connectHandler{ |j_socket| hndlr.call(NetSocket.new(j_socket)) } self end |
- (Object) host
Get the host
70 71 72 |
# File 'src/main/api_shim/core/net.rb', line 70 def host @j_del.host end |
- (Object) listen(port, host = "0.0.0.0", &hndlr)
Instruct the server to listen for incoming connections.
54 55 56 57 |
# File 'src/main/api_shim/core/net.rb', line 54 def listen(port, host = "0.0.0.0", &hndlr) @j_del.listen(port, host, ARWrappedHandler.new(hndlr) {|j_del| self}) self end |
- (Object) port
Get the port
65 66 67 |
# File 'src/main/api_shim/core/net.rb', line 65 def port @j_del.port end |