SokDoc

sok / Sok.Socket.TCP / TCPServerSocket

TCPServerSocket

expect class TCPServerSocket (source)

Class representing a listening socket. You can use it to perform accept() operation only.

Properties

exceptionHandler var exceptionHandler: (exception: Throwable) -> Unit
Lambda that will be called when an exception resulting in the closing of the socket is thrown, for further information look at the “Exception model” part of the README
isClosed var isClosed: Boolean
keep track of the socket state

Functions

accept suspend fun accept(): TCPClientSocket
Accept a client socket. The method will suspend until there is a client to accept
close fun close(): Unit
close the server socket