-
Notifications
You must be signed in to change notification settings - Fork 197
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
Connection timeout #65
Comments
Yeah I tried it out and commented on #76, so it looks like a connection timeout cannot be implemented with the current API (without dropping to lower-level socket calls). |
There's a bit more to it than that. I'm looking at it... |
I think I've found the problem. Hope to have a fix posted over the weekend. I've got the code complete but haven't finished testing. Will advise... With this fix, the new connect API will look like this:
The |
Decided to enhance the above a bit more. You won't have to set the Socket into non-blocking mode to use the timeout. You just have to supply a timeout value greater than zero. Here's the new documentation for the connect API from the README.md:
This new API is available in version 0.12.60. |
Going to close this for now. Feel free to re-open if you run into any issues. Thanks. |
Hello,
It looks like there's no way to set a connection timeout right now? There's a read/write timeout that was added (awesome!) but it would be nice to have a connection timeout too. From what I've read here (http://stackoverflow.com/questions/2597608/c-socket-connection-timeout, second answer is more detailed than accepted one), it involves setting the socket in non-blocking mode and using select with a timeout until the socket is connected (the socket can then be put back in blocking mode if that was how it was requested initially).
I believe the BlueSocket package exposes everything needed to implement this, but this is a non-trivial piece of code and it would make for a much nicer API to have e.g. a
timeout: TimeInterval
(orUInt
in milliseconds, as is the case for read/write timeouts) parameter added to theconnect
variants.Thoughts? And thanks for the great package!
Martin
The text was updated successfully, but these errors were encountered: