cURL
Haxx ad
libcurl

Shopping cart software, Online file storage, Online photo storage, Hosted shopping cart, Contact management software, Email marketing software, Project management software, Issue tracking software, Online notepad, Web publishing software

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Archives

Re: Is it possible to break the timeout of select call?

From: Marco Maggi <marco.maggi-ipsu_at_poste.it>
Date: Tue, 24 Nov 2009 09:18:13 +0100

"centrio" wrote:
> Earlier I had used timeout of 1min and I used to do select
> only once. No I have timeout of 1sec and I am looping over
> it for 1 minute. Is it equivalent to my previous setup?

I will take the risk of misunderstanding you. Why are you
calling select with a 1 second timeout?

  When you open a socket, events happen on it and the OS
takes care of queuing incoming data and action requests;
"select()" is a mean to make the application aware about
such queued stuff. One is of course free to model his
application the way he wants, but the use of a "long"
timeout with "select()" is mainly to abort operations one or
more sockets when no events happen (and so we can assume
that the connection is dead).

  If the application is multitasking among socket operations
and other actions, a very small timeout or no timeout is
enough to poll the state of a socket to collect events
happened since the last "select()" or other operations.

  For example, the interpreter of the Tcl language
implements an event loop with which one can serve file
descriptor events, timer events and graphical user interface
events; for file descriptors (in a certain mode of
operations), Tcl calls "select()" with a zero timeout for
each registered descriptor.

-- 
Marco Maggi
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-24

These mail archives are generated by hypermail.

donate! Page updated November 16, 2009.
web site info

File upload with ASP.NET