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

From: Valentin Nechayev (
Date: 04/23/03

From: Valentin Nechayev <>
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


Relevant Pages

  • non blocking sockets and alternatives
    ... It seems either non-blocking sockets can be used or ... Java's non blocking sockets and registered the ... What's peculiar is that after reading, ... Looking into the use of non-blocking ...
  • Re: Socket Programming
    ... there are two basic models I would ... just using non-blocking i/o doesn't solve the ... sockets from different clients and you need to find the one that at ...
  • Re: on the semantics of connect(): EINTR, EALREADY, EINPROGRESS
    ... Since it's then essentially a non-blocking connect, ... The quote in question describes what selectand poll() do, ... don't see why blocking sockets would be available in the first place ... connection on a *single* socket. ...
  • Re: BSD sockets: recv with MSG_WAITALL should return EWOULDBLOCK?
    ... (I am not convinced it is much use for blocking sockets ... It is useful for bulk downloads. ... blocking inside the kernel until that application buffer has been ...
  • Re: Socket Send
    ... Are your sockets blocking or non-blocking? ... be sending/reading in 4k increments, so I figured I'd start blocking the data on the server side, which would mean I'd have to be locking a mutex for a buffer and having a seperate thread running every say half a second to flush whatever data is in the buffer. ... Set the socket to non-blocking. ... It'll take some finagling because right now I have 1 function that does the readand 1 that does the write, and every process I have that does sockets uses them. ...