Re: Issuing connect(2) after select(2) on non-blocking socket
Re: Issuing connect(2) after select(2) on non-blocking socket
- Subject: Re: Issuing connect(2) after select(2) on non-blocking socket
- From: Dado Colussi <email@hidden>
- Date: Sun, 25 Jun 2017 08:16:33 -0500
It's incorrect to call connect() twice.
Try this:
Call connect() on the non-blocking TCP socket and expect it to return -1
and to set errno to EINPROGRESS. Then select() the socket for writing. 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.
Dado
_______________________________________________
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