LIBWIRE
Next-generation C++17 networking library.
|
I'm not using C++ anymore and have zero interest in libwire development. All current code in libwire is working as it should, so you can use it if you really want but using https://github.com/irisjyf/evpp if you need something production-ready.
     
C++ networking library. This repository contains implementation of platform-independent wrapper on top system TCP & UDP implementation.
C++17 compatible compiler
MSVC is not supported currently due to cryptic errors. If you know how to fix them - please, send PR.
``` $ git clone https://github.com/foxcpp/wire $ cd wire $ mkdir build; cd build $ cmake .. -DCMAKE_BUILD_TYPE=Release $ cmake –build . ```
Note 1 By default libwire will be built as a static library, if you want a shared library then you should add -DBUILD_SHARED_LIBS=ON
flag.
Note 2 It's recommended to enable LTO in your compiler to allow cross-object inlining and stuff.
If you use CMake and clone libwire as a submodule, you can just link it this way: ```cmake add_subdirectory(wire/) target_link_libraries(your-exectuable libwire) ``` It will use CMake magic to configure include path and other stuff.
Alternatively, you can access system-installed version using find_package
. ```cmake find_package(libwire REQUIRED) target_link_libraries(your-executable libwire) ```
Let's write a simple TCP server that echoes back \n
-terminated strings.
First, include TCP listener header and another one for ipv4::any
: ```cpp include <libwire/tcp/listener.hpp> include <libwire/address.hpp> ```
Then... It's very short so it doesn't needs any commentary: ```cpp using namespace libwire;
tcp::listener listener({ipv4::any, 7});
while (true) { auto sock = listener.accept(); auto str = sock.read_until<std::string>('
'); sock.write(str); } ```
See examples/ directory for sources and documentation for detailed description.
Maintained in Markdown format (for separate page) and as a docstrings in code (for reference). Documentation for lastest commit in master is availiable here. You can also build it locally by running make doc
. Ouput will be placed in doxygen_output/
directory.
Note Undocumented public function which behavior is not obvious is A BUG. Report it!
Here is some of the ways that you can contribute:
dev
branch, compile it and start trying to break stuff! :-)See CODE_STYLE.md and CONTRIBUTING.md for more details.
Distributed under terms of the MIT license. It allows you to do anything with libwire as long as you don't remove any copyright notices. Also, there is no warranties about anything.
See LICENSE.md for details.