Discussion:
[Wt-interest] Http Client never gets a response: wrong use pattern?
Antonio Mancina
2015-07-23 08:47:27 UTC
Permalink
Dear all,

Here

http://codeviewer.org/view/code:5392

you can find the code I'm asking your help about. It's the Hello example from
the wt-3.3.4 tree, expanded with the sample code of the Wt Http Client from
the documentation.

At line 91, there's a commented out call to a std::async. That call is meant
as an alternative mechanism to the direct call at line 96.

The problem is that this code never gets the Http response (same thread as
the Wt main loop), while the std::async call (offloading the http part to
another thread) correctly retrieves and prints the blog content.

Please note that both pattern obviously get to the "REQUEST SENT" part.

Is there any problem with using the http client in the wt main loop? Or am
I doing anything else wrong?

Thanks a lot,
Antonio

------------------------------------------------------------------------------
Wim Dumon
2015-07-28 11:18:34 UTC
Permalink
Hey,

I tested the code you posted (without any changes) and it simply works? I
tested on Windows.

Wim.
Post by Antonio Mancina
Dear all,
Here
http://codeviewer.org/view/code:5392
you can find the code I'm asking your help about. It's the Hello example from
the wt-3.3.4 tree, expanded with the sample code of the Wt Http Client from
the documentation.
At line 91, there's a commented out call to a std::async. That call is meant
as an alternative mechanism to the direct call at line 96.
The problem is that this code never gets the Http response (same thread as
the Wt main loop), while the std::async call (offloading the http part to
another thread) correctly retrieves and prints the blog content.
Please note that both pattern obviously get to the "REQUEST SENT" part.
Is there any problem with using the http client in the wt main loop? Or am
I doing anything else wrong?
Thanks a lot,
Antonio
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
Antonio Mancina
2015-07-28 23:31:19 UTC
Permalink
Hey Wim,

I don't know what to say, I gave it another test run and now it works for me as well.
Maybe it was a temporary problem of the website itself which was randomly serving the
content upon my requests and I was unlucky enough to associate it to the different
code versions.

Apologies for the noise on the list.
Antonio
Hey,
I tested the code you posted (without any changes) and it simply works? I tested on Windows.
Wim.
Dear all,
Here
http://codeviewer.org/view/code:5392
you can find the code I'm asking your help about. It's the Hello example from
the wt-3.3.4 tree, expanded with the sample code of the Wt Http Client from
the documentation.
At line 91, there's a commented out call to a std::async. That call is meant
as an alternative mechanism to the direct call at line 96.
The problem is that this code never gets the Http response (same thread as
the Wt main loop), while the std::async call (offloading the http part to
another thread) correctly retrieves and prints the blog content.
Please note that both pattern obviously get to the "REQUEST SENT" part.
Is there any problem with using the http client in the wt main loop? Or am
I doing anything else wrong?
Thanks a lot,
Antonio
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Continue reading on narkive:
Loading...