Check if client TCP connection is not closed
This is more of a question than an issue. Is there a way to check if the TCP connection is not closed? As far as I can tell the TcpStream is not exposed in any way from the client and thus its methods are not usable
Yep. We accept everything that is AsyncRead + AsyncWrite, including things such as the NamedPipeClient. This means having a specific API for asking the questions from whatever implements these traits is not the easiest thing to do.
Do you need to get that info from the connection, or would a dumbest and fastest possible query do the trick?
Thanks for the response. I wanted a cheap way to check for the connection status without having to send anything over the wire (which is not 100% reliable but good enough). Would it be possible to expose the concrete underlying transport from a client method?
In particular I wanted to use something like this http://stefan.buettcher.org/cs/conn_closed.html to detect closed connections. I am exploring options, without being certain that this is doable with tokio.
If you'd like to try up with a PR to see what kind of API would work for you, I'd give it a review and merge to main if it works.