View on GitHub

chops-net-ip

Chops Net IP ("C"onnective "H"andcrafted "Op"enwork "S"oftware) is a tasty C++ library that makes asynchronous IP network coding fun! Or at least this library makes asynchronous network programming easier and safer without sacrificing significant performance.

Branch Status
Master Build Status
Develop Build Status

Chops Net IP - Connective Handcrafted Openwork Software for Asynchronous IP Networking

Chops Net IP is a C++ library that makes asynchronous networking programming fun. Or at least if not fun, it makes network programming easier and safer, without significantly sacrificing performance. Chops Net IP handles Internet Protocol (IP) communications including TCP, UDP, and UDP multicast. It is written using modern C++ design idioms and the latest (2017) C++ standard.

Chops Net IP is not like any other high-level, general purpose C++ socket library.

Chops Net IP is layered on top of the Asio asynchronous networking library, taking advantage of the portability and functionality that Asio provides. However, it simplifies network programming compared to coding against the Asio API, while providing easy scalability through the asynchronous facilities.

License

Licence

This project is distributed under the Boost Software License.

Chops Net IP Release Status

Release 1.0 is under development as of January 2020, awaiting CMake enhancements, a comprehensive tutorial, and additional testing under multiple compilers and platforms.

Release notes and upcoming development plans are available here.

Overview

For many software developers, asynchronous network programming in C++ is not easy. It is complex, has many pitfalls, and requires designing C++ code in a way that is not natural, even for those with years of experience. Chops Net IP (“C”onnective “H”andcrafted “Op”enwork “S”oftware, Networking over Internet Protocol) simplifies asynchronous network programming and provides useful (and tasty!) abstractions for many types of communication patterns.

Chops Net IP is layered on top of Chris Kohlhoff’s Asio library (see References) allowing it to be portable across many compilers and platforms. When the C++ Networking TS is standardized (possibly C++ 23 but more likely C++ 26) Chops Net IP will directly use the networking facilities of the C++ standard library.

Chops Net IP simplifies application code that processes data on multiple simultaneous TCP connections or UDP endpoints. All Chops Net IP operations (from the application viewpoint) are no-wait (i.e. there are no blocking methods) and all network processing operations are performed asynchronously.

Tasty Bites

Chops Net IP functionality:

Chops Net IP is designed to make it easy and efficient for an application to create hundreds (or thousands) of network connections and handle them simultaneously. In particular, there are no threads or thread pools within Chops Net IP, and it works well with only one application thread invoking the event loop (an executor, in current C++ terminology).

Tasty Uses

Example environments where Chops Net IP is a good fit:

Examples

Example demo programs are in the /example directory.

The simple_chat_demo.cpp program has a listing of the multiple steps to set up working example.

Want More?

A detailed overview, a C++ socket library comparison, and a FAQ is available here.

C++ Language Requirements and Alternatives

C++ 17 is the primary standards baseline for this repository. There is also one future C++ facility in use (std::expected, allowing error handling without using exceptions).

A significant number of C++ 11 features are in the implementation and API. There are also C++ 14 and 17 features in use such as std::byte, std::optional, std::variant and auto parameters in lambda functions. For users that don’t want to use the latest C++ compilers or compile with C++ 17 flags, Martin Moene provides an excellent set of header-only libraries that implement many useful C++ 17 library features (for older compilers or standards), as well as future C++ features (see References).

While the main production branch will always be developed and tested with C++ 17 features (and relatively current compilers), alternative branches and forks for older compiler versions are welcome. In particular, a branch using Martin’s libraries and general C++ 11 (or C++ 14) conformance would be useful. A branch supporting a pre-C++ 11 compiler or language conformance is not likely to be directly supported through this repository (since it would require so many changes that it would result in a defacto different codebase).

External Dependencies

The libraries and API’s have minimal (as possible) library dependencies (there are heavy dependencies on the C++ standard library in all of the code). There are more dependencies in the test code than in the production code.

All the dependencies listed below have links that will take you to the library or repository.

Production external dependencies:

Test external dependencies:

There are single file headers that have been copied into the third_party directory of the utility-rack repository from various GitHub repositories and do not require any external dependency management. These are:

See References for additional details.

Supported Compilers and Platforms

Chops Net IP has been compiled and tests run on:

Follow the CI links for additional build environments.

Installation

Chops Net IP is header-only, so installation consists of downloading or cloning and setting compiler include paths appropriately. No compile time configuration macros are defined.

References

See References for details on dependencies and inspirations for Chops Net IP.

About

Team member information is available here, and a few random author comments are available here.