Re: postform.c in a loop seg faults

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 UTC