Libwww event manager

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Libwww event manager

Ivan Tarapov

Hello everyone

 

I need some held with libwww event manager.

 

I have got an example running that makes a call to HTLoadToChunk. And then copies the response body to a string.

The code is like that:

 

chunk = HTLoadToChunk(sCallRequest.c_str(), request);

bool bOk = false;

if (chunk) {

      char * resp_string = NULL;

      // wait until the request is over

      HTEventList_loop (request);

      resp_string  = HTChunk_toCString(chunk);

 

      if(resp_string  != NULL){

            sReturnData = resp_string ;

            bOk = true;

            HT_FREE(resp_string );

      }

      }

 

Here my application goes to infinite loop after call to HTEventList_loop. If I remove HTEventList_loop, I don’t get anything in resp_string because (as I presume) the body hasn’t been downloaded by the time.

 

I think that I need to register some callbacks and break the event loop after the body has been downloaded. But how do I do that?

 

Thanks,

Ivan