Re: How to add timeout?

At 11:37 5/26/98 -0400, Chris Lin wrote:

>Can you show me how to add timeout handling to this sample program?

You can see how to set event time outs in the Robot.c code

	http://www.w3.org/Robot/src/HTRobot.c

Henrik

>> Re: Retrieving a file from a server, cont.
>> 
>> Henrik Frystyk Nielsen (frystyk@w3.org)
>> Wed, 06 May 1998 17:44:10 -0400
>> 
>>    * Messages sorted by: [ date ][ thread ][ subject ][ author ]
>>    * Next message: Henrik Frystyk Nielsen: "Re: Retrieving a file from a
server, cont."
>>    * Previous message: Aravind Selvaraje: "Re: Need info & help"
>>    * Next in thread: Henrik Frystyk Nielsen: "Re: Retrieving a file from
a server, cont."
>> 
>>   ------------------------------------------------------------------------
>> 
>> Message-Id: <3.0.5.32.19980506174410.02fb3100@localhost>
>> Date: Wed, 06 May 1998 17:44:10 -0400
>> To: "Adam Ipnarski" <adam@fastfare.co.uk>
>> From: Henrik Frystyk Nielsen <frystyk@w3.org>
>> Cc: www-lib@w3.org
>> In-Reply-To: <000f01bd792e$2c232840$c284989e@checkin.demon.co.uk>
>> Subject: Re: Retrieving a file from a server, cont.
>> 
>> At 21:33 5/6/98 +0100, Adam Ipnarski wrote:
>> >>>>
>> Thank you for your help in the last problem - it has been solved, I took
>> the main bits from HTLine.c and used that.
>> Still continuing my quest to finish this program, I have one more question
>> concerning libwww.
>> <<<<
>> 
>> >>>>
>> 
>> This seems to do the job of loading a URI and save it to a file on Windows
>> as well as Unix.
>> 
>> You can also see a quick hack for how to integrate libwww with MFC at
>> 
>>         http://www.w3.org/Library/WinCom.html
>> 
>> Henrik
>> 
>> ***
>> #include "WWWLib.h"                           /* Global Library Include
file */#include
>> "WWWMIME.h"                                 /* MIME parser/generator
*/#include "WWWNews.h"
>>  /* News access module */#include "WWWHTTP.h"
      /* HTTP access
>> module */#include "WWWFTP.h"#include "WWWFile.h"#include
>> "WWWGophe.h"#include "WWWInit.h"#define APP_NAME
"GETTOOL"#define
>> APP_VERSION             "1.0"#define DEFAULT_OUTPUT_FILE     "get.out"
>> 
>> /*
>> **  We get called here from the event loop when we are done
>> **  loading. Here we terminate the program as we have nothing
>> **  better to do.
>> */
>> int terminate_handler (HTRequest * request, HTResponse * response,
>>                        void * param, int status)
>> {
>>     /* Delete our request again */
>>     HTRequest_delete(request);
>> 
>>     /* Delete our profile */
>>     HTProfile_delete();
>> 
>>     exit(status ? status : 0);
>> }
>> int main (int argc, char ** argv){    int                       status =
0;         int
>>     arg = 0;    char *              outputfile = NULL;
>>     char *              getme = NULL;
>>     HTRequest *         request = NULL;
>>     HTChunk *           chunk = NULL;
>>     /* Initiate W3C Reference Library with a client profile */
>> HTProfile_newNoCacheClient(APP_NAME, APP_VERSION);
>>     /* Add our own filter to terminate the application */
>>     HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);
>> 
>>     /* Turn off any interactions */
>>     HTAlert_setInteractive(NO);
>>     /* Scan command line for parameters */    for (arg=1; arg<argc; arg++)
>> {        if (!strcmp(argv[arg], "-o")) {             outputfile = (arg+1 <
>> argc && *argv[arg+1] != '-') ?                argv[++arg] :
>> DEFAULT_OUTPUT_FILE;                    } else {            getme =
>> argv[arg];        }    }
>>     /* Make sure we have an output */
>>     if (!outputfile) outputfile = DEFAULT_OUTPUT_FILE;
>>     if (getme && *getme) {
>>         request = HTRequest_new();
>> 
>>         /* Start the load */
>>         status = HTLoadToFile(getme, request, outputfile);
>> 
>>         /* Go into the event loop... */
>>         HTEventList_loop(request);
>> 
>>     } else {
>> 
>>         /* Delete our profile if no load */
>>         HTProfile_delete();
>>     }    return 0;}
>> 
>>   ------------------------------------------------------------------------
>> 
>>    * Messages sorted by: [ date ][ thread ][ subject ][ author ]
>>    * Next message: Henrik Frystyk Nielsen: "Re: Retrieving a file from a
server, cont."
>>    * Previous message: Aravind Selvaraje: "Re: Need info & help"
>>    * Next in thread: Henrik Frystyk Nielsen: "Re: Retrieving a file from
a server, cont."
>
--
Henrik Frystyk Nielsen,
World Wide Web Consortium
http://www.w3.org/People/Frystyk

Received on Wednesday, 27 May 1998 18:00:41 UTC