Stazer / autonomouscabs

2 stars 0 forks source link

Replace baremetal socket code with boost.asio #13

Closed Stazer closed 4 years ago

Stazer commented 4 years ago

In order to have fully tested socket code we can use boost.asio, which is a bullet-proof, high level and very fast library for networking and socket operations in general. It requires writing some boilerplate code, but in my opinion we should go for it, since our current solution is not tested and not fully portable.

IOService tutorial: https://www.boost.org/doc/libs/1_73_0/doc/html/boost_asio/overview/core/basics.html

Protocol tutorial: https://www.boost.org/doc/libs/1_73_0/doc/html/boost_asio/overview/networking/protocols.html

Here is an example of a chat client: https://www.boost.org/doc/libs/1_73_0/doc/html/boost_asio/example/cpp11/chat/chat_client.cpp

Including boost.asio: https://www.boost.org/doc/libs/1_73_0/doc/html/boost_asio/using.html

Overview of the library: https://www.boost.org/doc/libs/1_73_0/doc/html/boost_asio.html

It will require some time to integrate everything. If you want I can do that, or help you.

HClassen commented 4 years ago

I replaced all socket related code with boost asio. The Makefile requires a BOOST_ROOT envoirment variable. Would be good if you take a look at the code.

Stazer commented 4 years ago

Looks good so far. If it works, you can merge everything into the master branch. You can test the socket connection using netcat.