public interface NetClient extends Measured
A TCP/SSL client.<p> Multiple connections to different servers can be made using the same instance.<p> This client supports a configurable number of connection attempts and a configurable delay between attempts.<p> If an instance is instantiated from an event loop then the handlers of the instance will always be called on that same event loop. If an instance is instantiated from some other arbitrary Java thread (i.e. when using embedded) then an event loop will be assigned to the instance and used when any of its handlers are called.<p> Instances of this class are thread-safe.<p>
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the client.
|
NetClient |
connect(int port,
String host,
Handler<AsyncResult<NetSocket>> connectHandler)
Attempt to open a connection to a server at the specific
port and host . |
metricBaseName, metrics
NetClient connect(int port, String host, Handler<AsyncResult<NetSocket>> connectHandler)
Attempt to 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
NetSocket
instance is supplied via the connectHandler
instance
void close()
Close the client. Any sockets which have not been closed manually will be closed here.
Copyright © 2014. All Rights Reserved.