Re: First steps problems
From: Niels Sandholt Busch <niels.busch@xxxxxx>
Date: Tue, 13 Mar 2007 08:54:27 +0100 (CET)
On Tuesday 13 March 2007 06:04, Andreev Nikita wrote:
> So the point is to call function like
>
> void MyClass::Func() {
>      MyClient->recv(1);
> }
>
> 4 times a second for example. But the timer in wxWidgets calls Func()
> regardless of the fact that is working already. And in some situations
> I receive "I\O error" and client disconnects. So I need to modify
> Func() this way:
>
> void MyClass::Func() {
>      if(!up) {
>              up = true;
>              MyClient->recv(1);
>              up = false;
>      }
> }

You can call MyClient->recv(0); This means that it returns immediately if 
there is no data available. If you get a fatal error or disconnect, just stop 
the timer.

\Niels