Instances of this class are created on the client side by an NetClient
when a connection to a server is made, or on the server side by a NetServer
when a server accepts a connection.
It implements both ReadStream and WriteStream so it can be used with
io. to pipe data with flow control.
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: the application-level protocol negotiated during the TLS handshake
|
| public Future | |
| public void | close(Handler<AsyncResult<Void>> handler)
Close the NetSocket and notify the |
| public NetSocket | Returns: a reference to this, so the API can be used fluentlythe handler handler)Set a handler that will be called when the NetSocket is closed |
| public NetSocket | |
| public Future | Returns: a future completed with the resultRedeclares as abstract: io. Calls |
| public void | end(Handler<AsyncResult<Void>> handler)
Redeclares io. Redeclares as abstract: io. Calls |
| public NetSocket | endHandler(Handler<Void> endHandler)
This handler might be called after the close handler when the socket is paused and there are still buffers to deliver. |
| public NetSocket | |
| public NetSocket | fetch(long amount)
Redeclares io. Fetch the specified |
| public NetSocket | |
| public String | Returns: the indicated server nameReturns the SNI server name presented during the SSL handshake by the client. |
| public boolean | |
| public SocketAddress | Returns: the local address for this connection, possiblynull (e.g a server bound on a domain socket)
If useProxyProtocol is set to true, the address returned will be of the proxy.
|
| public SocketAddress | localAddress(boolean real)
Like |
| public NetSocket | pause()
Redeclares io. Pause the |
| public X509Certificate[] | Returns: an ordered array of the peer certificates. Returns null if connection is not SSL.
Deprecated
instead use
peerCertificates() or sslSession()
|
| public List | Returns: an ordered list of the peer certificates. Returns null if connection is not SSL.
|
| public SocketAddress | Returns: the remote address for this connection, possiblynull (e.g a server bound on a domain socket).
If useProxyProtocol is set to true, the address returned will be of the actual connecting client.
|
| public SocketAddress | remoteAddress(boolean real)
Like |
| public NetSocket | resume()
Redeclares io. Resume reading, and sets the buffer in |
| public default Future | |
| public default Future | Returns: a future result of the send operationfile name of the file to send filename, long offset offset)Tell the operating system to stream a file as specified by |
| public Future | Returns: a future result of the send operationfile name of the file to send filename, long offset offset, long length length)Tell the operating system to stream a file as specified by |
| public default NetSocket | Returns: a reference to this, so the API can be used fluentlyfile name of the file to send filename, Handler<AsyncResult<Void>> handler resultHandler)Same as |
| public default NetSocket | Returns: a reference to this, so the API can be used fluentlyfile name of the file to send filename, long offset offset, Handler<AsyncResult<Void>> handler resultHandler)Same as |
| public NetSocket | Returns: a reference to this, so the API can be used fluentlyfile name of the file to send filename, long offset offset, long length length, Handler<AsyncResult<Void>> handler resultHandler)Same as |
| public NetSocket | setWriteQueueMaxSize(int
the max size of the write stream maxSize)Redeclares io. Set the maximum size of the write queue to |
| public SSLSession | Returns: SSLSession associated with the underlying socket. Returns null if connection is not SSL.
|
| public NetSocket | Returns: a reference to this, so the API can be used fluentlythe handler will be notified when it's upgraded handler)Upgrade channel to use SSL/TLS. |
| public Future | |
| public NetSocket | Returns: a reference to this, so the API can be used fluentlythe server name serverName, Handler<AsyncResult<Void>> the handler will be notified when it's upgraded handler)Upgrade channel to use SSL/TLS. |
| public Future | upgradeToSsl(String serverName)
Like |
| public void | write(String str, Handler<AsyncResult<Void>> handler)
Redeclares io. Same as |
| public Future | Returns: a future result of the writethe string to write str)Redeclares io. Write a |
| public void | write(String str, String enc, Handler<AsyncResult<Void>> handler)
Same as |
| public Future | |
| public void | write(Buffer message, Handler<AsyncResult<Void>> handler)
Redeclares io.
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Like |
| public String | Returns: the write handler IDWhen a |
| applicationLayerProtocol | back to summary |
|---|---|
public String applicationLayerProtocol()
| |
| close | back to summary |
|---|---|
| public Future Close the NetSocket | |
| close | back to summary |
|---|---|
| public void close(Handler<AsyncResult<Void>> handler) Close the NetSocket and notify the | |
| closeHandler | back to summary |
|---|---|
| public NetSocket closeHandler(@Nullable Handler<Void> handler) Set a handler that will be called when the NetSocket is closed | |
| drainHandler | back to summary |
|---|---|
public NetSocket drainHandler(Handler<Void> handler)
| |
| end | back to summary |
|---|---|
| public Future Redeclares as abstract: io. Calls | |
| end | back to summary |
|---|---|
| public void end(Handler<AsyncResult<Void>> handler) Redeclares io. Redeclares as abstract: io. Calls
| |
| endHandler | back to summary |
|---|---|
| public NetSocket endHandler(Handler<Void> endHandler)
This handler might be called after the close handler when the socket is paused and there are still buffers to deliver.
| |
| exceptionHandler | back to summary |
|---|---|
public NetSocket exceptionHandler(Handler<Throwable> handler)
| |
| fetch | back to summary |
|---|---|
| public NetSocket fetch(long amount) Redeclares io. Doc from io. Fetch the specified | |
| handler | back to summary |
|---|---|
public NetSocket handler(Handler<Buffer> handler)
| |
| indicatedServerName | back to summary |
|---|---|
| public String indicatedServerName() Returns the SNI server name presented during the SSL handshake by the client.
| |
| isSsl | back to summary |
|---|---|
public boolean isSsl()
| |
| localAddress | back to summary |
|---|---|
public SocketAddress localAddress()
| |
| localAddress | back to summary |
|---|---|
| public SocketAddress localAddress(boolean real) Like | |
| pause | back to summary |
|---|---|
| public NetSocket pause() Redeclares io. Doc from io. Pause the
While it's paused, no data will be sent to the data | |
| peerCertificateChain | back to summary |
|---|---|
| public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException
Deprecated instead use
| |
| peerCertificates | back to summary |
|---|---|
public List
| |
| remoteAddress | back to summary |
|---|---|
public SocketAddress remoteAddress()
| |
| remoteAddress | back to summary |
|---|---|
| public SocketAddress remoteAddress(boolean real) Like | |
| resume | back to summary |
|---|---|
| public NetSocket resume() Redeclares io. Doc from io. Resume reading, and sets the buffer in
If the | |
| sendFile | back to summary |
|---|---|
| public default Future Tell the operating system to stream a file as specified by | |
| sendFile | back to summary |
|---|---|
| public default Future Tell the operating system to stream a file as specified by | |
| sendFile | back to summary |
|---|---|
| public Future Tell the operating system to stream a file as specified by | |
| sendFile | back to summary |
|---|---|
| public default NetSocket sendFile(String filename, Handler<AsyncResult<Void>> resultHandler) Same as | |
| sendFile | back to summary |
|---|---|
| public default NetSocket sendFile(String filename, long offset, Handler<AsyncResult<Void>> resultHandler) Same as | |
| sendFile | back to summary |
|---|---|
| public NetSocket sendFile(String filename, long offset, long length, Handler<AsyncResult<Void>> resultHandler) Same as | |
| setWriteQueueMaxSize | back to summary |
|---|---|
| public NetSocket setWriteQueueMaxSize(int maxSize) Redeclares io. Doc from io. Set the maximum size of the write queue to
The value is defined by the implementation of the stream, e.g in bytes for a
| |
| sslSession | back to summary |
|---|---|
public SSLSession sslSession()
| |
| upgradeToSsl | back to summary |
|---|---|
| public NetSocket upgradeToSsl(Handler<AsyncResult<Void>> handler) Upgrade channel to use SSL/TLS. Be aware that for this to work SSL must be configured.
| |
| upgradeToSsl | back to summary |
|---|---|
| public Future Like | |
| upgradeToSsl | back to summary |
|---|---|
| public NetSocket upgradeToSsl(String serverName, Handler<AsyncResult<Void>> handler) Upgrade channel to use SSL/TLS. Be aware that for this to work SSL must be configured. | |
| upgradeToSsl | back to summary |
|---|---|
| public Future Like | |
| write | back to summary |
|---|---|
| public void write(String str, Handler<AsyncResult<Void>> handler) Redeclares io. Same as | |
| write | back to summary |
|---|---|
| public Future Redeclares io. Write a | |
| write | back to summary |
|---|---|
| public void write(String str, String enc, Handler<AsyncResult<Void>> handler) Same as | |
| write | back to summary |
|---|---|
| public Future Write a | |
| write | back to summary |
|---|---|
| public void write(Buffer message, Handler<AsyncResult<Void>> handler) Redeclares io. References Deprecated
See corresponding docs for further information. Like | |
| writeHandlerID | back to summary |
|---|---|
| public String writeHandlerID() When a
By default, no handler is registered, the feature must be enabled via Given this ID, a different event loop can send a buffer to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other connections which are owned by different event loops.
| |