简体   繁体   English

Qt:设计QtcpSocket与多个TcpServer连接吗?

[英]Qt:Design QtcpSocket to connect with Multiple TcpServer?

I want to design an Application with QTcpSocket to connect to multiple servers and get data from each server and display it on the GUI. 我想设计一个带有QTcpSocket的应用程序,以连接到多个服务器并从每个服务器获取数据并将其显示在GUI上。

A QTcpServer with multiple Client is quiet easy. 具有多个客户端的QTcpServer非常容易。 But I need to design my application in a very similar way. 但是我需要以非常相似的方式设计应用程序。

In my application i need to connect to 40 devices ( Servers). 在我的应用程序中,我需要连接到40台设备(服务器)。 These devices gets data through some sources and they transfer this data to my application. 这些设备通过某些来源获取数据,并将这些数据传输到我的应用程序。 In my application, the data recieved from the individual server, will be splitted and displayed in the prescribed format along with the server details such as IP address port number etc. 在我的应用程序中,将从单个服务器接收的数据拆分并以指定的格式显示,并显示服务器详细信息,例如IP地址端口号等。

Single Socket-Server communication is done but I wonder about the effective way to connect to multiple server via single socket?? 单套接字-服务器通信已经完成,但是我想知道通过单套接字连接到多台服务器的有效方法吗?

Can any one guide me the effective ways to connect to multiple TcpServer and recieve data from each server ?? 谁能指导我连接到多个TcpServer并从每个服务器接收数据的有效方法?

Any Idea, Suggestions, Links are most welcome. 任何想法,建议,链接是最欢迎的。

Thanks in Advance. 提前致谢。

A single QTcpSocket is designed to connect to a single server. 单个QTcpSocket设计为连接到单个服务器。 You will need 40 QTcpSockets to connect to 40 QTcpServers simultaneously. 您将需要40个QTcpSockets才能同时连接到40个QTcpServer。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM