Results 1 to 2 of 2

Thread: CL_HTTPClientConnection example?

  1. #1

    Default CL_HTTPClientConnection example?

    CL_HTTPServer is working like a champ for me now, thanks for the help.

    Now, I have need for CL_HTTPClientConnection. (I can pull in libcurl, but that's more work and more code to deal with.) CL_HTTPClientConnection looks reasonably straightforward, though I'll step through the code to reverse out the details.

    As there are no docs or example for it, any pointers, or snippets you can point me to for CL_HTTPClientConnection?

    Thanks!

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    A simple example might look like this:

    Code:
    CL_HTTPClientConnection connection(CL_SocketName("www.clanlib.org", "80"));
    
    std::vector<CL_StringRef8> headers;
    headers.push_back("Host: www.clanlib.org");
    headers.push_back("User-Agent: MyApplication/1.0 ClanLib/2.1");
    connection.send_get("/", headers);
    
    CL_DataBuffer response_data;
    CL_String status_text;
    int status_code = connection.receive_response(status_text, response_data);
    The API of this class is not particular elegant. It was written at a time where I was playing around with pipelining requests, so the idea was that you could dispatch multiple send_xx requests without waiting for a response.

Similar Threads

  1. Replies: 9
    Last Post: 04-08-2010, 02:59 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •