Opens a TCP tunnel to a TCP server through a Nabto enabled device connected to earlier. The ip address of the server is configured in the device. Often it is configured to localhost.
| +--------+ +-----------+ +--------+ | | nabto | nabto | nabto | tcp/ip | remote | | |--+ client +----~~~---+ device +----~~~-----|--+ server | | port | API | | | port | | | +--------+ +----------+ +--------+
- NABTO_CLIENT_EC_OK if opening went ok
- NABTO_CLIENT_EC_NOT_FOUND if requesting an unknown service
- NABTO_CLIENT_EC_FORBIDDEN if target device did not allow opening a tunnel to specified service for the current client
- NABTO_CLIENT_EC_STOPPED if the tunnel is stopped.
- NABTO_CLIENT_EC_NOT_CONNECTED if the connection is not established yet.
- NABTO_CLIENT_EC_PRIVILEGED_PORT if the connection is not established because the port is privileged and the user does not have access to start a listening socket on that port number.
NABTO_CLIENT_DECL_PREFIX void NABTO_CLIENT_API nabto_client_tcp_tunnel_open(NabtoClientTcpTunnel* tunnel, NabtoClientFuture* future, const char* service, uint16_t localPort)
- [in] Tunnel handle crated with nabto_client_tcp_tunnel_new.
- [in] The future.
- [in] The service on the remote host to connect to.
- [in] The local TCP port to listen on. If the localPort number is 0 the api will choose the port number.