connect

suspend fun connect(host: String = "127.0.0.1", port: Int = DEFAULT_NETSIM_HCI_PORT, connectTimeout: Duration = 3.seconds): TcpHciPacketIo

Connects a new TcpHciPacketIo to a TCP H4 HCI endpoint (such as netsimd --hci-port or Rootcanal).

Return

a connected TcpHciPacketIo.

Parameters

host

target hostname or IP address (defaults to "127.0.0.1").

port

target TCP port (defaults to DEFAULT_NETSIM_HCI_PORT).

connectTimeout

maximum time to wait for the TCP connection to establish.

Throws

IOException

if the connection fails or times out.

CancellationException

if the coroutine is cancelled.