Document number: P1446r0 Date: 2019-01-18 Project: Programming Language C++ Audience: All of WG21 Reply-to: Christopher Kohlhoff <chris@kohlhoff.com>
This paper proposes the incorporation of the Networking TS N4771 into the C++20 working draft.
The Asio library, on which the Networking TS is based, was first developed in 2003 and accepted into the Boost C++ libraries after a review in 2005.
In 2006-7, a TR2 proposal was developed based on Asio.
In 2014, WG21 decided to open a project for a networking Technical Specification using Asio as its base. The specification underwent an exhaustive review by LWG during a week-long special meeting held during February 2015 in Cologne. Design modifications arising from this meeting were discussed and approved by LEWG at the subsequent Lenexa meeting in May 2015. The process completed in 2018 with the official publication of the Networking TS.
However, even though the Asio library implementation is mature, the interface has continued to evolve over the years to adopt new C++ language and library features, such as move support, coroutines and, more recently, executors.
The Asio library, both as part of Boost and as a standalone library, is widely used across many industries and applications. A variant of the Asio library that conforms to the namespaces and type names of the Technical Specification is also available, and is automatically generated from the Asio code base.
An implementation of the Technical Specification has been merged into libstdc++ for inclusion in a future release of the gcc compiler.
It is easy to point to an existing, widely used library and claim that the needs of the C++ user community are already met. Unfortunately, this is not a viable answer for all members of the community as, for reasons that may be technical or that may be political, use of a third-party implementation may not be possible.
Furthermore, unlike some library facilities, networking cannot be built wholly on top of the existing standard libary. An implementation requires the use of OS system calls or other libraries which exist outside the standard.
Incorporating networking is a priority of the Direction Group, as described in P0939 Directions for ISO C++. Users are clamouring for its addition. The inclusion of networking facilities in the standard would finally provide the building blocks on which higher-level library facilities can be developed, such as support for browsers through HTTP, and other commonly used internet protocols.
Finally, it is worth noting that while the 200+ page count of the Networking TS may seem daunting, a significant portion of it is due to the inclusion of executors (and consequently these sections would be subsumed by C++20 executor support), as well as integration with and support for other existing standard facilities such as iostreams.
Apply networking wording from N4771 to the working draft with the following changes:
experimental::
with nothing.<experimental/HEADER>
with <HEADER>
for each header listed in N4771 section [summary].namespace experimental {
and } // namespace experimental
.inline namespace v1 {
and } // namespace v1
.Subsequently, consider incorporating changes described in P0958 and P1322 to integrate networking facilities with C++20 executors.
Thanks go to Roger Orr for providing feedback on a draft of this paper.
[N4771] J. Wakely. Working Draft, C++ Extensions for Networking.
[P0939] H. Hinnant, R. Orr, B. Stroustrup, D. Vandevoorde, M. Wong. Directions for ISO C++.
[P0958] C. Kohlhoff. Networking TS changes to support proposed Executors TS.
[P1322] C. Kohlhoff. Networking TS enhancement to enable custom I/O executors.