Using ktor-network I have a case where the server ...
# ktor
r
Using ktor-network I have a case where the server sends a data packet and then immediately sends a RST packet. Is there any way to avoid the race between the socket read and the` IOException: connection reset by peer`?
a
Can you please share a code snippet to reproduce the issue?
r
I can try to reproduce it but the basic idea is that the server sends data, then does a connection close with RST. On the client, when it tries to do
read
, the
read
does not (usually) read the data sent, but instead fails with
IOException: connection reset by peer
.
I'm actually not sure how to simulate the server-side of this with Ktor: how do I get it to close the connection with a RST? Doesn't seem like I can set
so_linger
to
0
in the acceptor options.
a
Unfortunately, at the moment you cannot avoid the race. I've created an issue to address this problem.
👍 1