cURL / Mailing Lists / curl-library / Single Mail


Re: IMAP not working reliably on Win32/VS2012

From: Jiří Hruška <>
Date: Thu, 5 Sep 2013 01:08:04 +0200

Hi Steve,

On Wed, Sep 4, 2013 at 11:48 PM, Steve Holme <> wrote:
> I hope all is well with yourself.
I'm fine as well, thank you. Though the summer was too short - again!

> That seems to solve problem 1, although I think that the check that decides
> whether to initiate a transfer or not at line 1488 then needs to become
> if(data->req.bytecount == size) rather than if(!size).
Oh, yes, of course, good catch.

>As such I've been debugging this evening and can report the following:
> (...) imap_done() is ultimately called as we would expect ;-)

> As we know, this has to deal with the FETCH_FINAL state so
> imap_block_statemach() is called. It then calls Curl_pp_statemach() which in
> turn calls Curl_socket_ready() but unfortunately the return value "rc"
> contains zero afterwards indicating that the connection has been closed as
> has just called select() ???
Uh, not necessarily closed, 0 means "timed out" (even with null
timeout), so it's like "no data ready right now". But there should
definitely be more data ready in the socket, as only the contents of
the downloaded message should have been read!

A wild guess - maybe you encountered this error after single-stepping
through a lot of code and the connection has closed before you got to
Curl_socket_ready()? It might hide a real problem elsewhere.
Also I think you can see individual recv()s and send()s in
Sysinternals Proccess Monitor, it might shed some light on what has
been read when and in how big chunks.

Anyway, what you described is really weird. Otherwise the rest of the
exchange would surely work fine now...

Kind regards,
List admin:
Received on 2013-09-05