Skip to content

Does tokio Tcp have an API or connection disconnection event to check if the connection is disconnected #6285

Answered by Darksonn
Hans-Wu-cn asked this question in Q&A
Discussion options

You must be logged in to vote

To do that, you should read from the socket. When the connection is closed, you will get a read of length zero.

See #3467 for discussion about waiting for disconnect without reading. It's not possible right now.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Hans-Wu-cn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants