• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Issuing connect(2) after select(2) on non-blocking socket
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issuing connect(2) after select(2) on non-blocking socket


  • Subject: Re: Issuing connect(2) after select(2) on non-blocking socket
  • From: email@hidden
  • Date: Mon, 26 Jun 2017 08:52:33 -0700

If you are able to reach the server it will likely return an immediate
error if nothing is listening on the port, so you will not get a
timeout.  Do a read() when select() returns read ready and it should
return an error.

On 2017-06-24 17:29, Carl Hoefs wrote:

> iOS 10.3 and macOS 10.12
>
> When issuing connect(2) and then select(2) on a non-blocking socket, is one
> expected to issue a second connect() call after the select() returns a 1?
>
> My code works except when there is nothing listening on the port of the
> specified server ip address.  The pre-select() connect() call returns
> EINPROGRESS 'Operation now in progress', and the select() call itself returns
> a 1 instead of a timeout or error.
>
> If I issue a second connect(), after the select() indicates there is 1
> descriptor ready for write, this correctly returns -1 and 'Connection
> refused'.
>
> But is this the proper way to handle this condition?
>
> -Carl
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Macnetworkprog mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Issuing connect(2) after select(2) on non-blocking socket
  • Next by Date: Re: Issuing connect(2) after select(2) on non-blocking socket
  • Previous by thread: Re: Issuing connect(2) after select(2) on non-blocking socket
  • Next by thread: Re: NSURLSessionStreamTask and HTTP(S) proxies
  • Index(es):
    • Date
    • Thread