- From: Thorsten Rinkenberger <rinkenberger@falkag.de>
- Date: Wed, 30 May 2001 14:53:59 +0200
- To: <www-lib@w3.org>
Hi, I have a little question concerning the w3c-libwww library and I'll be very grateful if one of you out there would be so kind and find some time to help me. Until now I'm not very known in web programming. But currently I'm writing a small C program in which I try to call several URL's. To call the URL's I use HTLoadToFile(url, request,file) and HTEventList_loop(request). At last the terminate handler I defined with HTNet_addAfter(...) is called. All this works fine when I call only one URL. But I like to call several URL's in a while() loop. In my current program version the terminate handler will be executed already after the first URL was called. How can I place all my requests in the event loop before the terminate handler is called? Below you can find the related parts of my source code. int TerminateHandler(HTRequest* request, HTResponse* response, void* param, int status) { HTRequest_delete(request); HTProfile_delete(); HTLibTerminate(); exit(status?status:0); } int InitW3CLib() { HTLibInit(APP_NAME,APP_VERSION); if (HTLib_isInitialized() == YES) return 0; else return -1; } int CallURL(char* strURL) { HTRequest* request = NULL; BOOL state = NO; HTProfile_newNoCacheClient(APP_NAME, APP_VERSION); HTNet_addAfter(TerminateHandler,NULL,NULL,HT_ALL,HT_FILTER_LAST); while (...condition...) { HTHost_setEventTimeout(10000); request = HTRequest_new(); if (request == NULL) return -1; state = HTLoadToFile(strURL, request, file); if (state != YES) return -1; HTEventList_loop(request); // AFTER THIS (i.e. AFTER THE FIRST CALL) THE TERMINATE HANDLER IS CALLED IMEDIATELY } return 0; } int main(int argc, char *argv[]) { ... if (InitW3CLib() != 0) exit -1; CallURL(strURL); exit (0); } I hope one of you will find some time to give me a useful hint. Many many thanks in advance. Greetings from Germany ... Best regards Thorsten
Received on Wednesday, 30 May 2001 08:55:53 UTC