<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>HI All</FONT></DIV>
<DIV><FONT face=Arial size=2>I am receiving one error 
BasicTaskScheduler::SingleStep() function</FONT></DIV>
<DIV><FONT face=Arial size=2>The error is 
--&gt;&nbsp;&nbsp;perror("BasicTaskScheduler::SingleStep(): select() 
fails");<BR></FONT></DIV>
<DIV><FONT face=Arial 
size=2>/////////////////////////////////////////////////////////////////////////////////////////</FONT></DIV>
<DIV><FONT face=Arial size=2>void BasicTaskScheduler::SingleStep(unsigned 
maxDelayTime) <BR>{<BR>&nbsp; fd_set readSet = fReadSet; // make a copy for this 
select() call<BR>&nbsp; <BR>&nbsp; DelayInterval const&amp; timeToDelay = 
fDelayQueue.timeToNextAlarm();<BR>&nbsp; struct timeval 
tv_timeToDelay;<BR>&nbsp; tv_timeToDelay.tv_sec = 
timeToDelay.seconds();<BR>&nbsp; tv_timeToDelay.tv_usec = 
timeToDelay.useconds();<BR>&nbsp; // Very large "tv_sec" values cause select() 
to fail.<BR>&nbsp; // Don't make it any larger than 1 million seconds (11.5 
days)<BR>&nbsp; const long MAX_TV_SEC = MILLION;<BR>&nbsp; if 
(tv_timeToDelay.tv_sec &gt; MAX_TV_SEC)<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; 
tv_timeToDelay.tv_sec = MAX_TV_SEC;<BR>&nbsp; }<BR>&nbsp; // Also check our 
"maxDelayTime" parameter (if it's &gt; 0):<BR>&nbsp; if (maxDelayTime &gt; 0 
&amp;&amp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (tv_timeToDelay.tv_sec &gt; 
(long)maxDelayTime/MILLION ||<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(tv_timeToDelay.tv_sec == (long)maxDelayTime/MILLION 
&amp;&amp;<BR>&nbsp;tv_timeToDelay.tv_usec &gt; 
(long)maxDelayTime%MILLION)))<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; 
tv_timeToDelay.tv_sec = maxDelayTime/MILLION;<BR>&nbsp;&nbsp;&nbsp; 
tv_timeToDelay.tv_usec = maxDelayTime%MILLION;<BR>&nbsp; }<BR>&nbsp; <BR>&nbsp; 
int selectResult = select(fMaxNumSockets, &amp;readSet, NULL, 
NULL,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;tv_timeToDelay);<BR>&nbsp; if 
(selectResult &lt; 0)<BR>&nbsp; {<BR>#if defined(__WIN32__) || 
defined(_WIN32)<BR>&nbsp;&nbsp;&nbsp; int err = 
WSAGetLastError();<BR>&nbsp;&nbsp;&nbsp; // For some unknown reason, select() in 
Windoze sometimes fails with WSAEINVAL if<BR>&nbsp;&nbsp;&nbsp; // it was called 
with no entries set in "readSet".&nbsp; If this happens, ignore 
it:<BR>&nbsp;&nbsp;&nbsp; if (err == WSAEINVAL &amp;&amp; readSet.fd_count == 
0)<BR>&nbsp;{<BR>&nbsp;&nbsp;err = 0;<BR>&nbsp;&nbsp;// To stop this from 
happening again, create a dummy readable socket:<BR>&nbsp;&nbsp;int 
dummySocketNum = socket(AF_INET, SOCK_DGRAM, 
0);<BR>&nbsp;&nbsp;FD_SET((unsigned)dummySocketNum, 
&amp;fReadSet);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; if (err != 0) 
<BR>&nbsp;{<BR>#else<BR>&nbsp;&nbsp;if (errno != EINTR &amp;&amp; errno != 
EAGAIN) <BR>&nbsp;&nbsp;{<BR>#endif<BR>&nbsp;&nbsp;&nbsp;// Unexpected error - 
treat this as fatal:<BR>#if 
!defined(_WIN32_WCE)<BR>&nbsp;&nbsp;&nbsp;perror("BasicTaskScheduler::SingleStep(): 
select() 
fails");<BR>#endif<BR>&nbsp;&nbsp;&nbsp;exit(0);<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp; 
// Handle any delayed event that may have come due:<BR>&nbsp; 
fDelayQueue.handleAlarm();<BR>&nbsp; <BR>&nbsp; // Call the handler function for 
one readable socket:<BR>&nbsp; HandlerIterator iter(*fReadHandlers);<BR>&nbsp; 
HandlerDescriptor* handler;<BR>&nbsp; // To ensure forward progress through the 
handlers, begin past the last<BR>&nbsp; // socket number that we 
handled:<BR>&nbsp; if (fLastHandledSocketNum &gt;= 0) {<BR>&nbsp;&nbsp;&nbsp; 
while ((handler = iter.next()) != NULL) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(handler-&gt;socketNum == fLastHandledSocketNum) break;<BR>&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp; if (handler == NULL) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
fLastHandledSocketNum = -1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iter.reset(); // 
start from the beginning instead<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; }<BR>&nbsp; 
while ((handler = iter.next()) != NULL) {<BR>&nbsp;&nbsp;&nbsp; if 
(FD_ISSET(handler-&gt;socketNum, &amp;readSet) 
&amp;&amp;<BR>&nbsp;FD_ISSET(handler-&gt;socketNum, &amp;fReadSet) /* sanity 
check */ &amp;&amp;<BR>&nbsp;handler-&gt;handlerProc != NULL) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fLastHandledSocketNum = 
handler-&gt;socketNum;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// Note: we set "fLastHandledSocketNum" before calling the 
handler,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // in case 
the handler calls "doEventLoop()" reentrantly.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(*handler-&gt;handlerProc)(handler-&gt;clientData, 
SOCKET_READABLE);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp; }<BR>&nbsp; if (handler == NULL &amp;&amp; fLastHandledSocketNum 
&gt;= 0) {<BR>&nbsp;&nbsp;&nbsp; // We didn't call a handler, but we didn't get 
to check all of them,<BR>&nbsp;&nbsp;&nbsp; // so try again from the 
beginning:<BR>&nbsp;&nbsp;&nbsp; iter.reset();<BR>&nbsp;&nbsp;&nbsp; while 
((handler = iter.next()) != NULL) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(FD_ISSET(handler-&gt;socketNum, &amp;readSet) &amp;&amp;<BR>&nbsp;&nbsp; 
FD_ISSET(handler-&gt;socketNum, &amp;fReadSet) /* sanity check */ 
&amp;&amp;<BR>&nbsp;&nbsp; handler-&gt;handlerProc != NULL) 
{<BR>&nbsp;fLastHandledSocketNum = 
handler-&gt;socketNum;<BR>&nbsp;&nbsp;&nbsp;&nbsp; // Note: we set 
"fLastHandledSocketNum" before calling the 
handler,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
// in case the handler calls "doEventLoop()" 
reentrantly.<BR>&nbsp;(*handler-&gt;handlerProc)(handler-&gt;clientData, 
SOCKET_READABLE);<BR>&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; if (handler == NULL) 
fLastHandledSocketNum = -1;//because we didn't call a handler<BR>&nbsp; 
}<BR>}<BR>//////////////////////////////////////////////////////////////////////////</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>with regards</FONT></DIV>
<DIV><FONT face=Arial size=2>rajesh</FONT></DIV></BODY></HTML>