All Projects → inetic → asio-utp

inetic / asio-utp

Licence: BSL-1.0 License
Boost.Asio wrapper over uTorrent's uTP library

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Labels

Projects that are alternatives of or similar to asio-utp

asyncio
A C++ implementation of an industrial-grade high-performance asynchronous network library, based on asio, similar to Python's asyncio, designed for stateful services, and can be used to quickly build a variety of online game servers, microservices and pressure testing tools
Stars: ✭ 48 (+77.78%)
Mutual labels:  asio
ufw
A minimalist framework for rapid server side applications prototyping in C++ with dependency injection support.
Stars: ✭ 19 (-29.63%)
Mutual labels:  asio
PhoneVR
Use Steam VR-enabled applications with your phone as HMD (Head-mounted display). The only Open-Source solution to similar commercial packages like VRidge, iVRy, Trinus etc etc.
Stars: ✭ 178 (+559.26%)
Mutual labels:  asio
SierraChartZorroPlugin
A Zorro broker API plugin for Sierra Chart, written in Win32 C++.
Stars: ✭ 22 (-18.52%)
Mutual labels:  asio
boost-wintls
Native Windows TLS stream wrapper for use with boost::asio
Stars: ✭ 24 (-11.11%)
Mutual labels:  asio
texugo
🦡 Fast, flexible, multiplatform, lightweight and, dependency-free message gateway
Stars: ✭ 18 (-33.33%)
Mutual labels:  asio
bsio
better asio wrapper (++asio)
Stars: ✭ 36 (+33.33%)
Mutual labels:  asio
asio-extensions
Additional functionality built on top of (Boost.)Asio
Stars: ✭ 16 (-40.74%)
Mutual labels:  asio
go-libutp
Go wrapper of libutp reference uTP C implementation
Stars: ✭ 75 (+177.78%)
Mutual labels:  utp
boost beast websocket echo
A collection of Demo applications to try to help you understand how Asio and Beast work
Stars: ✭ 12 (-55.56%)
Mutual labels:  asio
tinyrpc
Much fast, lightweight, async, based boost.beast and protobuf.
Stars: ✭ 32 (+18.52%)
Mutual labels:  asio
modern async cpp example
Just some example code from a lecture about modern async C++
Stars: ✭ 34 (+25.93%)
Mutual labels:  asio
foxy
Session-based Beast/Asio wrapper requiring C++14
Stars: ✭ 61 (+125.93%)
Mutual labels:  asio
kcptun-asio
A kcptun based on c++11/asio, compatible with kcptun(golang)
Stars: ✭ 74 (+174.07%)
Mutual labels:  asio
mtxclient
Client API library for Matrix, built on top of Boost.Asio
Stars: ✭ 21 (-22.22%)
Mutual labels:  asio
aedis
An async redis client designed for performance and scalability
Stars: ✭ 118 (+337.04%)
Mutual labels:  asio
czspas
Minimalistic socket library inspired by Asio/Boost Asio, implemented in 1 single header file
Stars: ✭ 25 (-7.41%)
Mutual labels:  asio
dicom
C++11 and boost based implementation of the DICOM standard.
Stars: ✭ 14 (-48.15%)
Mutual labels:  asio
Magic
C++ Rapid development library based on Inversion of Control
Stars: ✭ 41 (+51.85%)
Mutual labels:  asio
asio-grpc
Asynchronous gRPC with Asio/unified executors
Stars: ✭ 100 (+270.37%)
Mutual labels:  asio

CircleCI

Asio wrapper over the uTorrent's (MIT licensed) uTP library

Features

Similar API to the TCP sockets in Asio. In particular, the utp::socket implements the AsyncReadStream and AsyncWriteStream requirements. Making it readily usable with Asio's free functions or classes utilizing those requirements. Such as async_read, async_write, ssl::stream, ...

Also similar to Asio's TCP sockets, utp::socket's async API supports callbacks, futures and coroutines as completion tokens.

The asio_utp::udp_multiplexer can be used to perform non uTP sending and receiving of UDP datagrams.

Advantages of uTP over TCP

  • Multiple uTP connections over one UDP port implies
    • better options to do NAT hole-punching
    • free hole-punching on certain types of NATs
    • fewer open file descriptors
  • Low latency
  • Yields to TCP

Clone

asio-utp git repository contains libutp (the uTorrents uTP library written in C) as a submodule. Thus one has to clone it recursively:

git clone --recursive [email protected]:inetic/asio-utp.git

Build

cd asio-utp
mkdir build
cd build
cmake .. -DBOOST_ROOT=<PATH_TO_BOOST_DIRECTORY>
make -j$(nproc)

For more detailed instructions, have a look at the .circleci/config.yml file.

Caveats

  • An accepting socket may only start sending after it received some data from the connecting socket (likely a consequence of this)
  • One has to implement their own timeouts and keep-alive packets because otherwise if the FIN UDP packet gets dropped by the network then the remaining socket won't get destroyed. Note that there is a mention of keep-alive packets in libutp/utp_internals.c, but those seem to be only used for preserving holes in NATs (not to indicate whether the other end is still alive).
  • The call to socket::async_connect simply executes the underlying libutp/utp_connect function. The latter sends one SYN packet but does not implement any timeout nor resending of that packet. This needs to be done explicitly by closing the socket after some timeout and then re-starting the call to socket::async_connect.

Architecture

    asio_utp::socket --- asio_utp::socket_impl ---+
                                                   \
    asio_utp::socket --- asio_utp::socket_impl -----+--- asio_utp::context
                                                   /             \
    asio_utp::socket --- asio_utp::socket_impl ---+               \
                                                                   \
                                          +----------- asio_utp::udp_multiplexer_impl
    asio_utp::udp_multiplexer ---+       /                              \
                                  \     /                                \
    asio_utp::udp_multiplexer -----+---+                          asio::udp::socket
                                  /
    asio_utp::udp_multiplexer ---+

TODO

  • Handle ICMP messages
  • Thread safety
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].