cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: select call returns without any data

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 7 Jan 2010 09:56:06 +0100 (CET)

On Thu, 7 Jan 2010, centrio_at_gmail.com wrote:

> if (CONNECTIONSTATE_CONNECT == state)

How does your program know/guess what state the handle is in?

> switch(ret)
> {
> case 0 : //If timeout has occured in CONNECT state then we are not able to
> connect to URL
> break;

... your code can't easily know if libcurl is in "connect state" or not thus
you can't tell the importance from a select() timeout that way.

> I have a timeout of 1 second for select call on curl FD's. For some URLsThe
> select call returns before 1 second but no callbacks get called.

That's normal and expected.

> I wanted to know why select call returns before 1 second without pulling any
> data? Is it because we are sending data to server?? (Get request)

Well obviosly none of the monitored sockets had traffic in the directions that
were checked.

> The select is waiting on write_fd's also. Does sending of Get Request to
> server changes write_fds?

All requests consist of parts sending and parts receiving. You have to send
data and receive data and during different times libcurl will use either, or
both. That's why the _fdset() function is provided!

> Is there Any way to know if only read_fds have been modified?

FD_ISSET() is the macro you use to check for a specific file decsription in
one of the fds sets when select() returns.

But if those are handles that libcurl manages for you, you really should not
bother or even try to care about such details.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-07