Overview
st_asio_wrapper is an asynchronous c/s framework based on Boost.Asio, besides all benefits brought by Boost and Boost.Asio, it also contain:
- Based on message just like UDP with several couple of build-in packer and unpacker;
- Support packer and unpacker customization, and replacing packer and unpacker at run-time;
- Automatically reconnect to the server after link broken;
- Widely support timers;
- Support object pool, object reusing;
- Support message buffer;
- Support ssl;
- Support TCP/UDP.
Quick start:
###server:
Derive your own socket from st_server_socket, you must at least re-write the on_msg or on_msg_handle virtual function and handle messages in it;
Create a st_service_pump object, create a st_server object, call st_service_pump::start_service;
Call st_server_socket::send_msg when you have messages need to send.
###client:
Derive your own socket from st_connector, you must at least re-write the on_msg or on_msg_handle virtual function and handle messages in it;
Create a st_service_pump object, create a st_tcp_client object, set server address via st_connector::set_server_addr, call st_service_pump::start_service;
Call st_connector::send_msg when you have messages need to send.
Directory structure:
Directory compatible_edition has the same structure as st_asio_wrapper, it is so called compatible edition, because it doesn't used any C++0x features, so it can be compiled by old compilers which don't support C++0x.
All source codes are placed in directory include, other directories hold demos (except compatible_edition).
Demos:
###asio_server:
Demonstrate how to implement tcp servers, it cantains two servers, one is the simplest server (normal server), which just send characters from keyboard to all asio_clients, and receive messages from all asio_clients (then display them); the other is echo server, which send every received message from test_clients back.
###asio_client:
Demonstrate how to implement tcp client, it simply send characters from keyboard to asio_server, and receive messages from asio_server (then display them).
###test_client:
Used to test the performance of echo server.
###file_server:
A file transfer server.
###file_client:
A file transfer client, use get <file name1> [file name2] [...] to fetch files from file_server.
###udp_client:
Demonstrate how to implement UDP communication.
###ssl_test:
Demonstrate how to implement TCP communication with ssl.
Compiler requirement:
Normal edition need Visual C++ 10.0, GCC 4.6 or Clang 3.1 at least;
Compatible edition does not have any limitations, just need you to compile boost successfully.
Boost requirement:
1.49 or highter, earlier edition maybe can work, but I'm not sure.
Debug environment:
win10 vc2008/vc2015 32/64 bit
Win7 vc2010 32/64 bit
Debian 7/8 32/64 bit
Ubuntu 16 64 bit
Fedora 23 64 bit
FreeBSD 10 32/64 bit
email: mail2tao@163.com
Community on QQ: 198941541