QTcpServer, I can't use the main event loop
Merlino last edited by
I need to add a TCP server to a large linux application which was developed in the past by others.
For reasons that I haven't had time to fully investigate, the internal app thread structure blocks the main loop of QT events and I can't change the structure without heavy refactoring.
I then tried to implement the TCP server in a separate thread by overriding "incomingConnection", but the method is not called, I think why the events loop is still required internally (with the event loop fully working this implementation work). Do you have any idea how this problem can be solved?
I have seen that a new QEventLoop can be created, but I am not sure if it could solve it.
If it were possible I would much prefer to use signals and slots, which make the code simpler and more performing.
Do you have any idea how this problem can be solved?
You can have Qt event loop in the thread where you're using QTcpServer: https://doc.qt.io/qt-5/qeventloop.html