W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2002

Re: postform.c in a loop seg faults

From: Deshakulakarni, Chandra <Chandra_Deshakulakarni@bmc.com>
Date: Fri, 7 Jun 2002 13:00:57 -0500
Message-ID: <85BCB1287CF1D41197570090279A6A0D029056B0@ES02-AUS.bmc.com>
To: "'www-lib@w3.org'" <www-lib@w3.org>
Cc: "'anibal@intelerad.com'" <anibal@intelerad.com>

I would suggest you to initialize and terminate LIBWWW only once
instead of doing it each time in the loop.

You can have two additional functions.

lib_init()
{

    /* Create a new premptive client */
    HTProfile_newNoCacheClient("TestApp", "1.0");

    /* Need our own trace and print functions */
    HTPrint_setCallback(printer);
    HTTrace_setCallback(tracer);

    /* Get trace messages */
#if 0
    HTSetTraceMessageMask("sop");
#endif

    /* Add our own filter to update the history list */
    HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);

    /* Set the timeout for long we are going to wait for a response */
    HTHost_setEventTimeout(20000);

    HTTP_setBodyWriteDelay (250, 500);
}

lib_term()
{

    /* Terminate libwww */
    HTProfile_delete();
}

Call lib_init() before your post loop and call lib_term()
after the loop.
You need to remove the init calls in your current post() function
and term call in your terminate_handler().

Hope this helps.

-Chandra
Received on Friday, 7 June 2002 14:01:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:42 GMT