bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

isPending(pendingError) useless


From: Wakan
Subject: isPending(pendingError) useless
Date: Fri, 16 Feb 2007 21:37:51 +0100
User-agent: Mozilla Thunderbird 1.5.0.9 (Windows/20061207)

Please,
some can explain how to use isPending(pendingError) to realize
that the other end of the socket is disconnected?
I'm trying this:

   setKeepAlive() ;
   while(!isPending(pendingError,0)) {
       if(isPending(pendingInput)) {
           nBytesAvail = peek(str,500);
           nBytesRead = readData(str,nBytesAvail);
if(nBytesAvail > 0) { .... } else break; // if this break is missing, it doesn't realize that the connection is down, but loops forever, so isPending(pendingError,0) doesn't work
       }
   }

If the client disconnects because a network error, the only way to know that
is to reduce the /proc/sys/net/ipv4/tcp_keepalive_time to 30
and tcp_keepalive_probe to 3 (has already suggested by someone in this list)
Is there a way to work better?
I tried to while(1) instead of while(!isPending(pendingError,0)) and if works in the
same way...is it right? so how to use isPending(pendingError)?
Thanks in advance





reply via email to

[Prev in Thread] Current Thread [Next in Thread]