How to enable creation of more than one chat room on same socket with boost ASIO? (C++)
So there is great chat server example, but how to create multyile rooms on same chat server with bo开发者_StackOverflow社区ost asio?
It's not possible to create multiple chat rooms with this example. It's a network programming example not a chat server.
The example chat server operates on a socket and doesn't have any logic regarding virtual chat rooms. One chat is bound to a single socket which is blocked for other instances of the chat server.
If you really want to operate multiple chat rooms with this chat server example you can bind individual instances of the chat server to other ports. An other way would be multiplexing the connections on the same socket using select
command or other multiplexing commands.
精彩评论