-
Notifications
You must be signed in to change notification settings - Fork 5
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
[net] Non portable options for "listen()" and "bind()"? #75
Comments
If I'm not mistaken, they're supported in consistent and portable way. Exactly as in Qt. Both on Windows and Unix reusing a socket does not automatically mean sharing it further. If that is to be changed, it should affect both variants. |
But one has to use the
This |
Certainly, as these are different option on Windows and *nix.
|
Right.
I think, it would be nice to merge them. |
Made it all simpler now. |
Good. BTW, is there any good way to detect disconnection or determine if a socket has become disconnected? |
Reading from such socket returns 0 bytes, writing should produce error; |
Currently I am exploiting this for the detection. Not very convenient, I am afraid.
I haven't tried. But there are only two methods for setting and getting the keep-alive option, I don't see exactly how to do that with these two methods. |
This is basically the only portable way, optionally coupled with
Well, you just enable the keep-alive on socket -- the method to track disconnects doesn't change. The option just makes inactive connection to periodically ping the remote end to see if it's alive, which may help to detect abnormal connection termination without explicit I/O. It is useful mainly for long-living connections which may stay idle for significant amount of time but nevertheless require to be notified about disconnects proactively. |
I notice that the socket option
SO_REUSEADDR
seems to be available on both Windows and Unix, yet the recent change inDaoNetwork_SetSocketOptions()
made it impossible to use that option in a portable way.The text was updated successfully, but these errors were encountered: