Class: Vertx::NetClient
- Inherits:
-
Object
- Object
- Vertx::NetClient
- Includes:
- Measured
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/net_client.rb
Overview
A TCP client.
Multiple connections to different servers can be made using the same instance.
This client supports a configurable number of connection attempts and a configurable delay between attempts.
Instance Method Summary (collapse)
-
- (void) close
Close the client.
-
- (self) connect(port = nil, host = nil) { ... }
Open a connection to a server at the specific port and host.
-
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object.
Instance Method Details
- (void) close
This method returns an undefined value.
Close the client.Any sockets which have not been closed manually will be closed here. The close is asynchronous and may not complete until some time after the method has returned.
52 53 54 55 56 57 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/net_client.rb', line 52 def close if !block_given? return @j_del.java_method(:close, []).call() end raise ArgumentError, "Invalid arguments when calling close()" end |
- (self) connect(port = nil, host = nil) { ... }
Open a connection to a server at the specific
port
and host
.
host
can be a valid host name or IP address. The connect is done asynchronously and on success, a
Vertx::NetSocket instance is supplied via the connectHandler
instance
40 41 42 43 44 45 46 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/net_client.rb', line 40 def connect(port=nil,host=nil) if port.class == Fixnum && host.class == String && block_given? @j_del.java_method(:connect, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(port,host,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::NetSocket.new(ar.result) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling connect(port,host)" end |
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object
26 27 28 29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/net_client.rb', line 26 def metrics_enabled? if !block_given? return @j_del.java_method(:isMetricsEnabled, []).call() end raise ArgumentError, "Invalid arguments when calling metrics_enabled?()" end |