Re: Issuing connect(2) after select(2) on non-blocking socket
site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com User-agent: Roundcube Webmail/1.1.5 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 (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/tim%40ivisit.com
This email sent to tim@ivisit.com
Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists... This email sent to site_archiver@lists.apple.com
participants (1)
-
tim@ivisit.com