W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2001

preemptive loading problem

From: Bonnin, Francis <Francis.Bonnin@fr6.vdogrp.de>
Date: Tue, 6 Mar 2001 18:52:52 +0100
Message-ID: <9FCFC14E26E5D311BC8000508B6568CC35C88A@sx1140.l140.vdogrp.de>
To: "'www-lib@w3.org'" <www-lib@w3.org>
Hi, I'm new in this mailing list and i'd like to thank you for all your
support and, of course, the libwww library.


I have got a problem, maybe you will be able to help me.
I wrote a program (with libwww) and, up to now, it seemed to work well on
linux and solaris (with a high speed connection)
Recently, i tryed to compile and run it under windows (at home with a low
speed connection) but it doesn't work anymore.

I use a method "load file" to load a file (in a preemptive way) at the
begining of the program.
under windows the method seems to do not wait for the file to be loaded and
return immediately (a null string).

why is this method not blocking ?
am i doing something wrong ?

/***************************************************************************
**************/
char *loadFile (char* url)
{
  HTRequest * request = HTRequest_new();
  HTChunk * chunk = NULL;
  
   
  printf("loading file : %s\n", url); 
  /* Set up the request and pass it to the Library */
  HTRequest_setOutputFormat(request, WWW_SOURCE);
  HTRequest_setPreemptive(request, YES);

  if (url) {
    char * cwd = HTGetCurrentDirectoryURL();
    char * absolute_url = HTParse(url, cwd, PARSE_ALL);
    HTAnchor * anchor = HTAnchor_findAddress(absolute_url);
    chunk = HTLoadAnchorToChunk(anchor, request);
    HT_FREE(absolute_url);
    HT_FREE(cwd);
  }

  /* Clean up the request */
  HTRequest_delete(request);

  if (chunk) {
    return HTChunk_toCString(chunk);
  }
  else {
    return NULL;
  }
}
/***************************************************************************
**************/

before using this method, i initialise the library like this :

/***************************************************************************
**************/


HTProfile_newNoCacheClient("Test", "1.0");
HTHost_setEventTimeout(25000);
HTPrint_setCallback(printer);
HTTrace_setCallback(tracer);
char * chaine = chargeFichier ("http://www.test.fr");

/***************************************************************************
**************/


I hope that you'll help me.

Thank you.

Francis.



-----------------------------------------------------------
This Mail has been checked for Viruses
Attention: Encrypted Mails can NOT be checked !

***

Diese Mail wurde auf Viren ueberprueft
Hinweis: Verschluesselte Mails koennen NICHT geprueft werden!
------------------------------------------------------------
Received on Tuesday, 6 March 2001 12:54:57 GMT

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