SokDoc

sok / Sok.Socket.TCP / TCPClientSocket / write

write

suspend fun write(buffer: MultiplatformBuffer): Boolean (source)

Platform and version requirements: Common

suspend actual fun write(buffer: <ERROR CLASS>): Boolean (source)

Platform and version requirements: JVM, JS, Native

Perform a suspending write, the method will not return until all the data between buffer.cursor and buffer.limit are written. The socket use an internal write queue, allowing multiple threads to concurrently write. Backpressure mechanisms should be implemented by the developer to avoid having too much data in the queue. If the peer closes the socket while reading, a PeerClosedException will be thrown. If the socket is manually closed while reading, either NormalCloseException or ForceCloseException will be thrown

Exceptions

SocketClosedException -

BufferUnderflowException -

SokException -

PeerClosedException -

Parameters

buffer - data to write

Return Success of the operation