24 Star 52 Fork 15

youngwolf / st_asio_wrapper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSL-1.0

st_asio_wrapper

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 contains:

  1. Based on message just like UDP with several couple of build-in packer and unpacker;
  2. Support packer and unpacker customization, and replacing packer and unpacker at run-time;
  3. Automatically reconnect to the server after link broken;
  4. Support object pool, object reusing and restoration;
  5. Worker thread management;
  6. Support message buffer;
  7. Widely support timers;
  8. Support TCP/UDP and Unix domin TCP/UDP;
  9. Support reliable UDP (base on KCP -- https://github.com/skywind3000/kcp);
  10. Support ssl;

Quick start:

server:

Derive your own socket from server_socket_base, you must at least re-write on_msg_handle virtual function and handle messages in it; Create a service_pump object, create a server_base<your_socket> object, call service_pump::start_service; Call server_socket_base::send_msg or server_base::broadcast_msg when you have messages need to send.

client:

Derive your own socket from client_socket_base, you must at least re-write the on_msg or on_msg_handle virtual function and handle messages in it; Create a service_pump object, create a multi_client_base<your_socket> object, add some socket via multi_client_base::add_socket, call service_pump::start_service; Call client_socket_base::send_msg or multi_client_base::broadcast_msg when you have messages need to send.

Directory structure:

All source codes are placed in directory include, other directories hold demos, for documents, please refer to this project https://github.com/youngwolf-project/ascs/ .

Demos:

echo_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 clients (from client demo), and receive messages from all clients (from client demo), then display them; the other is echo server, which send every received message from echo_client demo back.

client:

Demonstrate how to implement tcp client, it simply send characters from keyboard to normal server in echo_server, and receive messages from normal server in echo_server, then display them.

echo_client:

Used to test st_asio_wrapper's performance (whith 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:

No special limitations, just need you to compile boost successfully.

Boost requirement:

1.49 or highter.

email: mail2tao@163.com

Community on QQ: 198941541

Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于boost.asio的c/s框架 展开 收起
C++ 等 3 种语言
BSL-1.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/youngwolf/st_asio_wrapper.git
git@gitee.com:youngwolf/st_asio_wrapper.git
youngwolf
st_asio_wrapper
st_asio_wrapper
master

搜索帮助