Any hints how to implement a simple asynchronous client using cpp-netlib? I assume, it won't be as long as boost asio async client. Code sample will be helpful. My pathetic attempt is below.

#include <iostream>
#include <string>
#include <boost/network/protocol/http/client.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/client/connection/connection_delegate_factory.hpp>
#include <boost/network/protocol/http/traits/delegate_factory.hpp>
#include <boost/network/protocol/http/client/connection/async_normal.hpp>

using namespace std;
using namespace boost::network;
using namespace boost::network::http;

typedef boost::function<void(boost::iterator_range<char const *> const &, boost::system::error_code const &)> body_callback_function_type;
typedef boost::iterator_range<char const *> rValue;

std::string res;

void callback(boost::iterator_range<char const *> const & a, boost::system::error_code const & b)
{
    for(rValue::difference_type i = 0; i < a.size(); ++i)
    {
        res += a[i];
    }
}

int main() {
    http::client client;
    http::client::request request("http://www.blekko.com/");
    http::client::response response = client.get(request, callback);
    while (!ready(response));
    cout << res << endl;
    return 0;
}
share|improve this question
Sorry I can't answer the question, but I have to point out that like all search engines, blekko.com doesn't allow people to access us via program without signing up for our API and using an API auth code. Please contact us at [email protected] to receive an API auth code. Thanks! – Greg Lindahl Oct 31 '12 at 7:28
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.