Giter Site home page Giter Site logo

wire's Introduction

libwire

Travis CI CodeCov Latest Release Issues License

C++ networking library. This repository contains implementation of platform-independent wrapper on top system TCP & UDP implementation.

Table of contents

Installation

Requirements

  • C++17 compatible compiler
  • (Optional) Google Test for tests (included as submodule)
  • (Optional) Doxygen for API documentation generation
$ 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.

Usage

Build system configuration

If you use CMake and clone libwire as a submodule, you can just link it this way:

add_subdirectory(wire/)
target_link_library(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.

find_package(libwire REQUIRED)
target_link_library(your-executable libwire)

In code

Let's write a simple TCP server that echoes back \n-terminated strings.

First, include TCP listener header:

#include <libwire/tcp/listener.hpp>

Then... It's very short so it doesn't needs any commentary:

using namespace libwire;

tcp::listener listener{ipv4::any, 7};

while (true) {
    auto sock = listener.accept();
    auto str = sock.read_until<std::string>('\n');
    sock.write(str);
}

Examples

See examples/ directory for sources and documentation for detailed description.

Documentation

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!

Contributing

Here is some of the ways that you can contribute:

  • Submit a bug report. We love hearing about broken things, so that we can fix them.
  • Provide feedback. Even simple questions about how things work or why they were done a certain way carries value.
  • Test code. Checkout dev branch, compile it and start trying to break stuff! :-)
  • Write code. Check issues marked with help wanted tag.

See CODE_STYLE.md and CONTRIBUTING.md for more details.

License

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.

wire's People

Contributors

foxcpp avatar

Forkers

cpptogether

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.