QTcpServer multiple clients without threads
I want to write a sever that can handle multiple clients and without using threads . I have already read some website about this topic . The main way is use a
QList(or other STL)and a
QSignalMapper,so when comes the data ,the
readyreadfunction how to get which client send this data ? And how to property handle one clinet disconnected (As for the Qlist remove control )?
On way is to used the sender method in your slot. You can take the Fortune Server Example as a starting point and rather than closing the connection at the end of the function, store it in your container.
Look at this as well. It's a threaded TCP server, but you can remove the
QThreadrelated code in the server object and you'd be good to go.