问题描述
我正在使用C ++(Windows和Linux)上的TCP客户端模拟器.这里可以模拟1000个客户端.每个客户端都有一些服务器可能需要的状态信息.服务器可以通过发出带有客户端ID的命令来获取特定客户端的状态.
服务器可能发出这些命令
1.开始流"将数据连续流传输到服务器.
2.停止流"-停止流
3.状态"-要求状态
客户回应
1.流数据
2.停止流式播放
3.将状态信息发送到服务器.
我们不能使用第三方库(boost等)来做到这一点.我需要用C ++实现.我遇到了多个I/O模型,例如Completion Port,Overlapped I/O等.我很困惑哪一个适合用于客户端应用程序.
1.我想知道哪种I/O模型适合客户端管理这些数字实例.
2.如何确保每个客户端实例的状态.
3.维护每个客户端状态信息的数据结构.
I am working on TCP Client Simulator on C++(windows and Linux).Here can simulate 1000 client.each client has some status information which server may require.Server can get the status of a particular client by issuing command with client ID.
Server may issue these command
1."start-stream"-streams the data to server continually.
2."stop stream"-stops the streaming
3."Status"-asking for status
client respond with
1.streams the data
2.stops the streaming
3.send status information to server.
We can''t use third party libraries(boost etc) to do this.I need to implement in C++.I came across the Several I/O model like Completion Port,Overlapped I/O etc.I am confused which one will suitable for the client application.
1.I wanted to know what I/O model is suitable for Client to manage these number instance.
2. how can I ensure the state of the each client instance.
3. data structure to maintain the status information of the each client.
推荐答案
这篇关于客户端处理多个套接字连接的IO模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!