sok / Sok.Socket.TCP / TCPClientSocket / read
suspend fun read(buffer:
MultiplatformBuffer
):
Int
(source)
Platform and version requirements: Common
suspend actual fun read(buffer: <ERROR CLASS>):
Int
(source)
Platform and version requirements: JVM, JS, Native
Perform a suspending read, the method will read n bytes ( 0 < n <= buffer.remaining() ) and update the cursor. 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
PeerClosedException
-
SocketClosedException
-
BufferOverflowException
-
ConcurrentReadingException
-
buffer
- buffer used to store the data read
Return Number of byte read
suspend fun read(buffer:
MultiplatformBuffer
, minToRead:
Int
):
Int
(source)
Platform and version requirements: Common
suspend actual fun read(buffer: <ERROR CLASS>, minToRead:
Int
):
Int
(source)
Platform and version requirements: JVM, JS, Native
Perform a suspending read, the method will read n bytes ( minToRead < n <= buffer.remaining() ) and update the cursor 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
PeerClosedException
-
SocketClosedException
-
BufferOverflowException
-
ConcurrentReadingException
-
buffer
- buffer used to store the data read
Return Number of byte read