"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

Reply via email to