Unsolved QThreadPool tutorial
-
Hi,
I've been trying to find a tutorial about asynchronous tcp server. I found a youtube that explains how to implement asynchronous server using QThreadPool. The only problem, in a later video, the guy who did the tutorial mentioned that he used a function incorrectly and that all of the online tutorials use these functions incorrectly.
Do you know of a trusted tutorial on the subject?
This is an area where a code can be put together but if it has a mistake it might not show up until a significant corruption took place.
-
Hi,
Can you give more details about that erroneous use of a function and also which function is it ?
-
moveToThread()
This post explains how it's used incorrectly
http://blog.qt.io/blog/2010/06/17/youre-doing-it-wrong/
For this reason, I want to know if a trusted example of a QThreadPool used to create an asynchronous server so I start in the right direction.
-
The latest documentation of QThread also explains this nicely.
It depends a bit on what you expect to do with your server.
-
The problem with the documentation is that it shows snippets of code. I was hoping to find a simple working program to study and start to develop it further.
-
@WhatIf Did you check whether there is something in the example apps from Qt?
-
See if this fits your requirements. It doesn't use a thread pool though, and starts a thread for each incoming connection so that may be a thing you'd want to change.