Re: on the semantics of connect(): EINTR, EALREADY, EINPROGRESS

From: Valentin Nechayev (netch@segfault.kiev.ua)
Date: 04/23/03


From: Valentin Nechayev <netch@segfault.kiev.ua>
Date: Wed, 23 Apr 2003 08:34:14 +0300


>>> David Madore wrote:

DM> Thanks, but this essentially shows that non-blocking sockets are far
DM> more complicated to use than blocking sockets (consider the number of
DM> lines in the code fragments under the first URL, as opposed to the six
DM> lines above). Non-blocking is good when one wants to test for events
DM> on a variety of sources: it is definitely overkill when testing
DM> connection on a *single* socket.

Non-blocking is good when you have event-driven program. If your program
has to deal with signals in the way more complicated than simple termination,
i.e. handle the signal and return to previous work, it is event-driven.

You showed in details that continuation of blocking connect() isn't possible
in the same way on different platforms. So, you should use nonblocking
connect().

-netch-



Relevant Pages