开发者

C++ & Boost: I'm trying to find an example TCP program with a server that accepts connections from multiple clients

A chat program would be a good enough example. Just need a server that can accept multiple 开发者_JAVA技巧connections from the clients, and the server needs to be able to send messages to individual clients.

I plan to turn this into a distributed computing program to work with multiple Neural Networks.


Asio is the Boost library that handles networking. There's a chat server example listed here.


I cannot give you an example progam. But to write a server things that you have to do:
1. server will listen at a port for connection
2. thread pool which will accept the connection and serve request
3. write the server code in thread safe manner

You have to use socket programming A good link for that http://beej.us/guide/bgnet/
you can use win32 api in windows and posix for linux

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜