https://kotlinlang.org logo
#ktor
Title
# ktor
e

Edoardo Luppi

03/30/2024, 3:56 PM
I wonder what's the correct way to check if a socket client is still connected. Should it be •
socket.isClosed
readChannel.isClosedForRead
writeChannel.isClosedForWrite
Or a combination of them?
e

ephemient

03/30/2024, 6:22 PM
it is possible for sockets to be half-closed, so it depends
a

Aleksei Tirman [JB]

04/02/2024, 6:48 AM
I think sending some kind of ping packet and receiving the answer is the most reliable solution.