C++ Network Library

_images/boost.png

Welcome

The cpp-netlib is a library that provides application layer protocol support using modern C++ techniques. It is light-weight, fast, cross-platform and is intended to be as easy to configure as possible.

It is developed by people linked to the Boost community and will at some point in the future be submitted for review into Boost. A presentation about cpp-netlib was given at BoostCon 2010, for which the slides and the paper can be found on-line.

Sneak Peek

The cpp-netlib allows you to write semantically consistent code for making different kinds of higher level network applications.

The library allows for writing simple code for simple C++ HTTP client applications:

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

client::request request_("http://www.boost.org/");
request_ << header("Connection", "close");
client client_;
client::response response_ = client_.get(request);
std::string body = body(response_);

The library also allows for writing simple C++ HTTP servers:

namespace http = boost::network::http;

struct handler;
typedef http::server<handler> http_server;

struct handler {
    void operator() (http_server::request const & request_,
                     http_server::response & response_) {
        response = http_server::response::stock_reply(
            http_server::response::ok, "Hello, world!");
    }

    void log(http_server::string_type const & info) {
        std::cerr << "ERROR: " << info << '\n';
    }

};

int main(int arg, char * argv[]) {
    handler handler_;
    http_server server_("0.0.0.0", "8000", handler_);
    server_.run();
}

The cpp-netlib is being developed for eventual submission to Boost.

Download

You can download the latest releases of the library at:

You can also get the latest developments from the Git repository at:

git://github.com/mikhailberis/cpp-netlib.git

You can find more information about the progress of the development by checking the GitHub project page at:

Support

You can ask questions, join the discussion, and report issues to the developers mailing list by joining via:

You may also file issues on the Github issue tracker at: