NetSocketImpl

class NetSocketImpl : NetSocket, CoroutineScope

A coroutine-based TCP/TLS transport with pooled output buffers.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
open override var listener: NetSocket.Listener?

The listener for socket events, or null.

Link copied to clipboard
open override val queueBytesOut: AtomicLong

The number of outgoing bytes currently queued for transmission.

Link copied to clipboard
open override var timeout: Int

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

Link copied to clipboard
open override val totalBytesIn: AtomicLong

The total number of bytes received during the current connection.

Link copied to clipboard
open override val totalBytesOut: AtomicLong

The total number of bytes sent during the current connection.

Functions

Link copied to clipboard
suspend fun awaitClosed()

Waits until connection setup and both I/O loops have exited after close.

Link copied to clipboard
open override fun close(disconnected: Boolean)

Closes the socket and forwards disconnected to Listener.onClose.

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

Starts a connection to the destination.

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

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

Link copied to clipboard
open override fun doOutput(buffer: ByteBuffer)

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