mbonnin
10/25/2023, 1:31 PMktor-network
, is it possible to force close a ServerSocket
that has active connections? I can get it to work on the JVM but SocketServer.close()
hangs on macosArm64
.val selectorManager = SelectorManager(<http://Dispatchers.IO|Dispatchers.IO>)
val serverSocket = aSocket(selectorManager).tcp().bind("127.0.0.1", port)
launch {
val socket = serverSocket.accept()
launch {
delay(15.seconds)
socket.close()
// hangs here
serverSocket.close()
}
socket.openReadChannel().readInt()
}
e5l
10/25/2023, 1:32 PMmbonnin
10/25/2023, 1:32 PMserverSocket.cancel()
, do you mean cancelling the scope?socket.cancel()
? (trying now... but same thing)e5l
10/25/2023, 1:36 PMmbonnin
10/25/2023, 1:36 PMe5l
10/25/2023, 2:31 PM