Kotlin: TcpTunnel.awaitOpen()
DESCRIPTION
Open a tunnel.
This is meant to be used in a Kotlin coroutine to suspend execution until the TcpTunnel is open.
DECLARATION
suspend fun TcpTunnel.awaitOpen(
service: String,
localPort: Int,
)
PARAMETERS
service:- The service to connect to on the remote device (as defined in the device's configuration), e.g. "http", "http-admin", "ssh", "rtsp".
localPort:- The local port to listen on. If 0 is specified, an ephemeral port is used, it can be retrieved with
getLocalPort().
THROWS EXCEPTIONS
NabtoRuntimeException:- with error code
FORBIDDENif the device did not allow opening the tunnel. NabtoRuntimeException:- with error code
STOPPEDif the tunnel or a parent object is stopped. NabtoRuntimeException:- with error code
NOT_CONNECTEDif the connection is not established yet.