-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a way to listen for tcp disconnects #29
Comments
Could this be built by using |
Not with the current API at least. |
Ah yeah that's true :( In general though something is going to be platform-specific here as "hup" as a signal is mosly a Unix-ism (and maybe only Linux? I forget) |
According to the answers on this stack overflow question you can detect a disconnect with Windows IOCP by doing a 0-byte read. The man page for kqueue also mentions some stuff about detecting socket disconnects using the |
Yeah, it seems non trivial... I'm going to close the issue for now as the issue is stale and it doesn't seem like this will pursued. However, if you want to continue the discussion, let me know and I can open it back up. |
Also interested in detecting hangups with TcpStreams, any ideas ? |
As I understand it, this wouldn't be possible with the way tokio is currently written because it doesn't distinguish between hup events and readable events. Assuming we can fix this, I'd like a way to detect when a tcp stream has closed without reading from it. The API could look something like this:
That would let you put the stream into a state where you're just waiting for it to close, but you could convert that state back into a
TcpStream
if you later decide you want to read from the stream.The text was updated successfully, but these errors were encountered: