How to know a TcpStream is closed in the other side?

There's some related discussion of checking for closed TCP streams in Rust here: