It would be really nice if there is a way to abort a TCP connection(RST). Currently by directly calling close() we get a different behavior on different platforms.
By having abort() functionality we can quickly terminate a connection that appear in a good state but the software detected that it is broken, for example by timeouts or garbage data due to an error in the other party. In such situations aborting the connection is the best thing you can do.
I can also propose a solution(as a workflow). The most cross-platform way to abort a connection is the following:
Set the socket to blocking mode(if not already in that mode).
Enable linger with zero timeout.
Call platform close/closesocket function.
If such functionality is welcome, I can even do the effort to implement it myself and create a PR, so please give your feedback! :)
Hello,
It would be really nice if there is a way to abort a TCP connection(RST). Currently by directly calling
close()
we get a different behavior on different platforms.By having
abort()
functionality we can quickly terminate a connection that appear in a good state but the software detected that it is broken, for example by timeouts or garbage data due to an error in the other party. In such situations aborting the connection is the best thing you can do.I can also propose a solution(as a workflow). The most cross-platform way to abort a connection is the following:
blocking
mode(if not already in that mode).linger
with zero timeout.If such functionality is welcome, I can even do the effort to implement it myself and create a PR, so please give your feedback! :)