KtorTcpTransport

TCP socket transport implementation using Ktor.

This provides a lightweight TCP transport layer using Ktor's networking APIs, suitable for use on Android and JVM platforms.

Parameters

host

Remote host to connect to

port

Remote port (default 22 for SSH)

Constructors

Link copied to clipboard
constructor(host: String, port: Int = 22, ipVersion: IpVersion = IpVersion.AUTO)

Properties

Link copied to clipboard
open override val isConnected: Boolean

Check if the transport is still connected.

Functions

Link copied to clipboard
open suspend override fun close()

Close the transport connection.

Link copied to clipboard
suspend fun connect()

Connect to the remote host. Must be called before any read/write operations.

Link copied to clipboard

Local TCP address assigned to the connected socket, or null before connection, after close, or when the injected socket does not expose it.

Link copied to clipboard
open suspend override fun read(count: Int): ByteArray

Read exactly count bytes from the transport.

Link copied to clipboard
open suspend override fun write(data: ByteArray)

Write all bytes to the transport.