首页 > 解决方案 > Boost Async Server 基于会话对象处理多个客户端

问题描述

我正在编写一个异步服务器,连接到服务器的客户端将请求多种类型的数据,我的意思是说......假设服务器是这里的餐厅

我该如何设计这个案例,或者在我的服务器代码中处理它???

通过给出的例子

https://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/ssl/server.cpp

new_session = new session(io_service_, context_);
      acceptor_.async_accept(new_session->socket(),
          boost::bind(&server::handle_accept, this, new_session,
            boost::asio::placeholders::error)); ```

1) So the multiple clients can be hanlded by multiple session object that are getting created. Is the statement correct ? 
2) Does server will keep each new_session object in a list to differentiate the clients SO that it will respond to them based on the type of request

标签: c++networkingboost-asio

解决方案


推荐阅读