connect

suspend fun connect(uri: String)

Parses an endpoint string and connects using connect.

Parameters

uri

An SRT URI such as srt://host:9000?mode=caller.

Throws

If the endpoint or a query option is unsupported.

If the string is not a valid URI.

If address resolution or native connection setup fails.

CancellationException

If setup is cancelled or its handshake times out.


suspend fun connect(uri: URI)

Establishes one peer connection. In listener mode this suspends until accept; observe LISTENING and localAddress to discover a dynamically allocated port.

Supports mode (caller/client, listener/server, rendezvous), adapter (local bind address), port (local port), latency (microseconds), conntimeo (milliseconds), passphrase, and streamid. Unknown and duplicate keys are rejected. Percent encoding is decoded; literal plus signs are preserved. The default port is 9710. An empty host selects listener mode; other hosts select caller mode unless mode is explicit. IPv4, IPv6 and DNS names are supported.

Caller local binds default to an ephemeral port; rendezvous local binds default to the remote port. Use close or caller cancellation to stop an indefinite accept wait. A failed/cancelled attempt releases all resources.

Parameters

uri

Endpoint and optional socket configuration; paths, user info and fragments are unsupported.

Throws

If another connection attempt or peer is owned.

If configuration is invalid or unsupported.

If address resolution or native setup fails.

CancellationException

If setup is cancelled or its handshake times out.