- From: Marjou Xavier <Xavier.Marjou@SRIT.siemens.fr>
- Date: Thu, 27 Jan 2000 11:41:08 -0500 (EST)
- To: "'www-lib@w3.org'" <www-lib@w3.org>
Hello, I have the following function which works well for retrieving html pages (I use NT machines). But if the http server does not answer immediatly, I would like to set a maximum waiting time of 10 sec, which I think I do by using HTHost_setEventTimeout(10000). But this instruction does not seem to be taken into account, as I have to wait between 45 and 55 sec to have the response when the http server takes this time to answer. Regards, Xavier =============================================================== int HTTPClient_getPage(char *url, char *page) { int result = 0; char* tempoPage = 0; HTRequest* request; HTChunk* chunk; HTProfile_newNoCacheClient("TestApp", "1.0"); HTHost_setEventTimeout(10000); request = HTRequest_new(); // Gotta set up our own traces HTPrint_setCallback(printer); HTTrace_setCallback(tracer); HTPrint("url: %s \n", url); // We want raw output including headers HTRequest_setOutputFormat(request, WWW_RAW); HTRequest_setPreemptive(request, YES); // Close connection immediately HTRequest_addConnection(request, "close", ""); if (url) { char * cwd = HTGetCurrentDirectoryURL(); char * absolute_url = HTParse(url, cwd, PARSE_ALL); chunk = HTLoadToChunk(absolute_url, request); HT_FREE(absolute_url); HT_FREE(cwd); // If chunk != NULL then we have the data if (chunk) { tempoPage = HTChunk_toCString(chunk); if (tempoPage) { strncpy(page, tempoPage, PAGE_LENGTH_MAX); HTPrint("%s", page ? page : "no text"); HT_FREE(tempoPage); result = 1; } } } else { HTPrint("Type the URL you want to accces on the command line\n"); } // Terminate the Library HTProfile_delete(); // Clean up the request HTRequest_delete(request); return result; }
Received on Thursday, 27 January 2000 11:41:54 UTC