NetSocket

interface NetSocket

A two-way TCP transport with optional TLS and asynchronous input callbacks.

Inheritors

Types

Link copied to clipboard
interface Listener

Receives connection, input, and error notifications from the transport.

Properties

Link copied to clipboard

The listener for socket events, or null.

Link copied to clipboard

The number of outgoing bytes currently queued for transmission.

Link copied to clipboard
abstract var timeout: Int

The transport timeout setting. NetSocketImpl currently stores this value without applying it to the socket.

Link copied to clipboard
abstract val totalBytesIn: AtomicLong

The total number of bytes received during the current connection.

Link copied to clipboard

The total number of bytes sent during the current connection.

Functions

Link copied to clipboard
abstract fun close(disconnected: Boolean)

Closes the socket and forwards disconnected to Listener.onClose.

Link copied to clipboard
abstract fun connect(dstName: String, dstPort: Int, isSecure: Boolean)

Starts a connection to the destination.

Link copied to clipboard
abstract fun createByteBuffer(capacity: Int): ByteBuffer

Obtains a writable buffer with the requested capacity in bytes, potentially reusing pooled storage.

Link copied to clipboard
abstract fun doOutput(buffer: ByteBuffer)

Queues a buffer for transmission. NetSocketImpl flips the buffer before sending its contents.