Giter VIP home page Giter VIP logo

Comments (6)

billabt avatar billabt commented on May 18, 2024 3

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:

public func connect(to host: String, port: Int32, timeout: UInt = 0) throws

The timeout parameter is ignored if blocking is not turned off for the Socket.

from bluesocket.

billabt avatar billabt commented on May 18, 2024 2

There's a bit more to it than that. I'm looking at it...

from bluesocket.

billabt avatar billabt commented on May 18, 2024 2

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:

  • connect(to host: String, port: Int32, timeout: UInt = 0) - This API allows you to connect to a server based on the hostname and port you provide. Note: an exception will be thrown by this function if the value of port is not in the range 1-65535. Optionally, you can set timeout to the number of milliseconds to wait for the connect. Note: If the socket is in blocking mode it will be changed to non-blocking mode temporarily if a timeout greater than zero (0) is provided. The returned socket will be set back to its original setting (blocking or non-blocking).

This new API is available in version 0.12.60.

from bluesocket.

SelvaBalasubramanian avatar SelvaBalasubramanian commented on May 18, 2024

@mna have u tried this...can you help me out with is case... i need fix a timeout for connect.
#76
can you pls check the above issue and help me out....

from bluesocket.

mna avatar mna commented on May 18, 2024

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).

from bluesocket.

billabt avatar billabt commented on May 18, 2024

Going to close this for now. Feel free to re-open if you run into any issues. Thanks.

from bluesocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.