Coder Social home page Coder Social logo

ascs's Introduction

ascs (a successor of st_asio_wrapper)

Overview

ascs is an asynchronous c/s framework based on Asio(non-Boost edition, http://think-async.com/), besides all benefits brought by 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;
  9. Support ssl;
  10. Can work alone or with Boost.
    Suggest using ascs if c++0x or higher is available (even you used Boost, but not Boost.Asio), otherwise st_asio_wrapper. And Asio(non-Boost edition) needs macro ASIO_STANDALONE to be defined, please note.

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 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/ascs/, demos are placed in directory examples, documents are placed in directory doc.

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 one 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 ascs'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:

Visual C++ 11.0, GCC 4.6 or Clang 3.1 at least, with c++11 features;

Community on QQ: 198941541

ascs's People

Contributors

youngwolf-project avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.