I've got a trouble understanding how to do correct timeouts handling with icqlib. Does anyone knows how to do it?
I'm using the current icqlib version (got it from cvs). Btw, is the project stalled or what? :) I see no updates in cvs for almost 5 weeks...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Uhm... thanks anyway... but it isn't the thing I asked about. I meant icq_SetTimeout callback and icq_HandleTimeout funcion. What should I do with them?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've got a trouble understanding how to do correct timeouts handling with icqlib. Does anyone knows how to do it?
I'm using the current icqlib version (got it from cvs). Btw, is the project stalled or what? :) I see no updates in cvs for almost 5 weeks...
put this somewhere after all the callsbacks are made in the Main()..
-----------------------------------------
void Test_ClientAlive(icq_link *pIcqlnkStruct)
{
struct timeval PreviousTimeValue;
struct timeval CurrentTimeValue;
gettimeofday(&PreviousTimeValue,NULL);
while(1)
{
usleep(1000000); //to prevent cpu hogging!!
icq_Main(pIcqlnkStruct);
gettimeofday(&CurrentTimeValue,NULL);
if(CurrentTimeValue.tv_sec - PreviousTimeValue.tv_sec > 120)
{
icq_KeepAlive(pIcqlnkStruct );
printf("sent keepalive packet-- sending again after 120 seconds \n");
memcpy(&PreviousTimeValue,&CurrentTimeValue,sizeof(struct timeval));
}
}
}
Uhm... thanks anyway... but it isn't the thing I asked about. I meant icq_SetTimeout callback and icq_HandleTimeout funcion. What should I do with them?
This link has all the details on how to use it..
http://www.geocrawler.com/lists/3/SourceForge/884/0/5714003/
Thank you very much. That link explained me all I wanted to know.