iTcpSocket

interface iTcpSocket

Properties

Link copied to clipboard
abstract val availableForRead: Int

Returns number of bytes that can be read without blocking. If the platform cannot determine this (TLS), -1 is returned

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
abstract fun close()

Close the underlying connection

Link copied to clipboard
abstract fun connect(name: String, port: Int, connectTimeout: Int, sockOptions: SocketOptions.() -> Unit? = null)

Attempt to connect

Link copied to clipboard
abstract fun flush()

force any writes to actually be sent

Link copied to clipboard
abstract fun isAlive(): Boolean

Return true if the underlying connection is ok

Link copied to clipboard
abstract fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int

Reads all available bytes to dst buffer and returns immediately or suspends if no bytes available @return number of bytes were read or -1 if the channel has been closed

Link copied to clipboard
abstract fun writeFully(src: ByteArray, offset: Int, length: Int)

Writes all src bytes and suspends until all bytes written. Causes flush if buffer filled up or when autoFlush Crashes if channel get closed while writing

Link copied to clipboard