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
-
Does tokio Tcp have an API or connection disconnection event to check if the connection is disconnected |
Beta Was this translation helpful? Give feedback.
Answered by
Darksonn
Jan 14, 2024
Replies: 1 comment
-
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. |
Beta Was this translation helpful? Give feedback.
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
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.