TcpTunnel.close()

DESCRIPTION

Note! Semantics have changed with version 3.0 due to name clash with AutoCloseable! The 2.x version of close() has been renamed to tunnelClose().

This function releases any resources associated with the TcpTunnel instance. This method is called automatically at the end of a try-with-resources block, which helps to ensure that resources are released promptly and reliably.

Example of using a CoAP object within a try-with-resources statement:

try (TcpTunnel tunnel = connection.createTunnel(...)) {
// ... use tunnel
}

With this setup, {@code close()} will be called automatically on {@code connect} at the end of the block, releasing any underlying native Nabto Client SDK resources without any further action required on the application.

If the try-with-resources construct is not feasible, the application must manually call close() when the TcpTunnel instance is no longer needed.</p>

Unlike the {@link AutoCloseable#close()} method, this {@code close()} method does not throw any exceptions.

DECLARATION

    @Override
    void close()