curl / Mailing Lists / curl-library / Single Mail


Re: Wait for a response using curl_multi_wait

From: Richard Copley <>
Date: Sun, 25 Mar 2018 12:03:26 +0100

On 22 March 2018 at 17:09, Richard Copley <> wrote:

> On 22 March 2018 at 15:16, Daniel Stenberg <> wrote:
>> On Wed, 21 Mar 2018, Richard Copley wrote:
>> Probably a stupid question, but in the example I was talking about, where
>>> does the socket returned by connect() fit in? After the first SYN packet
>>> has been sent, and before the SYN/ACK arrives, can't curl wait on that
>>> socket?
>> Yes it can and it does. The typical no-socket gap in time is before that
>> socket is created, when libcurl resolves a host name in a separate thread.
> Oh, I had been assuming the resolve had happened synchronously, but I
> didn't check.
> I did some packet-sniffing. The results are in an earlier message in this
> thread. If you have the time and energy, and if you can make any sense of
> what I wrote, would you mind having a look at it? It looked to me as though
> what you describe wasn't happening (i.e., curl wasn't waiting on that
> socket), but I'm not really confident of that.

I don't imagine anyone else was worried, but I kept trying to see why my
results seemed to contradict what Daniel said.
One problem was that my timestamps were inaccurate (and not just
imprecise). With better timestamps, the contradiction disappears (when the
SYN is on the wire, curl_multi_wait doesn't indicate a no-socket gap).
I won't bore you with more details.

Received on 2018-03-25