openage icon indicating copy to clipboard operation
openage copied to clipboard

Use libuv for asynchronous operations like networking

Open TheJJ opened this issue 9 years ago • 8 comments

Additional to our job subsystem, it might come in handy to use libuv:

http://libuv.org/

We can use it primarily for network transmissions, for filesystem access our job system is good enough already I hope.

TheJJ avatar Mar 08 '16 14:03 TheJJ

Boost.Asio is another option, see this comparison.

rkreis avatar Mar 08 '16 21:03 rkreis

Or ENet.

TheJJ avatar Mar 09 '16 01:03 TheJJ

I worked much with libuv now in an university project. It is a plain C library, but can be used with C++ very well (mainly pass this as the void *userdata and use non-capturing lambdas). So I'll probably choose it.

TheJJ avatar Jan 26 '17 23:01 TheJJ

Piece of Nodejs :) https://nikhilm.github.io/uvbook/index.html Good reading.

Wandalen avatar Jan 27 '17 06:01 Wandalen

@TheJJ, the C++ standard will adopt Asio.

VelorumS avatar Jun 13 '17 06:06 VelorumS

Uuh, when? :)

TheJJ avatar Jun 13 '17 11:06 TheJJ

@TheJJ , the C++ Network Technical Specification is expected to be published by the end of 2017. It would eventually be merged into the C++ standard for C++ 2020. I guess we could expect compilers to be shipped with experimental network TS feature by the end of 2019 (with clang/libc++ I guess).

The current network TS draft is available here : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4656.pdf

For an in-depth comparison : https://stackoverflow.com/questions/11423426/how-does-libuv-compare-to-boost-asio

IMHO, boost asio or libuv are both solid choices that should be considered. The fact that boost asio will eventually be standardized one day is not a killer argument by itself. Overall, it is just a good modern C++ networking library.

inakoll avatar Jun 13 '17 12:06 inakoll

http://cbor.io/ might be an option for serialization

TheJJ avatar Feb 26 '19 10:02 TheJJ