Re: Issuing connect(2) after select(2) on non-blocking socket
site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com
On Jun 25, 2017, at 6:16 AM, Dado Colussi <dado.colussi@gmail.com> wrote:
When select() indicates that the socket is ready for writing, check the status of the asynchronous connect() using getsockopt() with SO_ERROR. If there's nothing accepting the connection, then getsockopt() should give you ECONNREFUSED.
getsockopt() isn't returning ECONNREFUSED... After the connect() returns EINPROGRESS, and after the select() indicates 1 descriptor ready for write, getsockopt() returns status=0, errno=0: status = getsockopt(sockfd,SOL_SOCKET,SO_ERROR,&error,&len); So I'm still forced to reissue the connect() to see if I can connect. -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/site_archiver%40lists... This email sent to site_archiver@lists.apple.com
participants (1)
-
Carl Hoefs