Class: Vertx::NetServer
- Inherits:
-
Object
- Object
- Vertx::NetServer
- Includes:
- SSLSupport, TCPSupport
- Defined in:
- src/main/ruby_scripts/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) client_auth_required=(val)
Client authentication is an extra level of security in SSL, and requires clients to provide client certificates.
-
- (Object) close(&hndlr)
Close the server.
-
- (NetServer) connect_handler(proc = nil, &hndlr)
Supply a connect handler for this server.
-
- (NetServer) initialize
constructor
Create a new NetServer.
-
- (NetServer) listen(port, host = "0.0.0.0")
Instruct the server to listen for incoming connections.
Methods included from SSLSupport
#key_store_password=, #key_store_path=, #ssl=, #trust_store_password=, #trust_store_path=
Methods included from TCPSupport
#receive_buffer_size=, #reuse_address=, #send_buffer_size=, #so_linger=, #tcp_keep_alive=, #traffic_class=
Constructor Details
- (NetServer) initialize
Create a new NetServer
33 34 35 |
# File 'src/main/ruby_scripts/core/net.rb', line 33 def initialize @j_del = org.vertx.java.deploy.impl.VertxLocator.vertx.createNetServer end |
Instance Method Details
- (Object) client_auth_required=(val)
Client authentication is an extra level of security in SSL, and requires clients to provide client certificates.
Those certificates must be added to the server trust store.
do not authenticate then they will not make a connection.
41 42 43 44 |
# File 'src/main/ruby_scripts/core/net.rb', line 41 def client_auth_required=(val) @j_del.setClientAuthRequired(val) self end |
- (Object) close(&hndlr)
Close the server. The handler will be called when the close is complete.
68 69 70 |
# File 'src/main/ruby_scripts/core/net.rb', line 68 def close(&hndlr) @j_del.close(hndlr) end |
- (NetServer) connect_handler(proc = nil, &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.
52 53 54 55 56 |
# File 'src/main/ruby_scripts/core/net.rb', line 52 def connect_handler(proc = nil, &hndlr) hndlr = proc if proc @j_del.connectHandler{ |j_socket| hndlr.call(NetSocket.new(j_socket)) } self end |
- (NetServer) listen(port, host = "0.0.0.0")
Instruct the server to listen for incoming connections.
62 63 64 65 |
# File 'src/main/ruby_scripts/core/net.rb', line 62 def listen(port, host = "0.0.0.0") @j_del.listen(port, host) self end |