Reputation: 10661
I'm going to write a program with more than one TCP servers listening on different ports.
But I can't find a sample or demo on this.
Should I create a thread for each server ?
Or could anyone give a link on some demo ?
Or give a overall description on the structure of the program ?
Upvotes: 0
Views: 240
Reputation: 1407
If you can find a sample for one server, you pretty much have a sample for multiple servers.
There is no need to make a thread for each server. You can create a QTcpServer
object for each server and add handlers for their newConnection
(see http://qt-project.org/doc/qt-4.8/qtcpserver.html#newConnection) signals.
From there on it is the same like with one server.
Upvotes: 2