Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Do multiple QTcpSockets need to be threaded to listen and read "simultaneously" ?



  • Hi everyone !

    I couldnt find my answer in QIODevice, QAbstractSocket or neither QTcpSocket documentations. There is my problem :

    I'd like to use multiple sockets (TCP), listening to a same server. The reason why i want to do this is that I suspect my actual application to "overload" the readyRead() slot's queued connection of the unique socket, making it having "lags" (it receives sound, and it's jerky when more than 2 clients are connected).

    There is the question : do multiple QTcpSockets need to be threaded to be able to read messages "simultaneously" ? I don't get if each QTcpSocket has their own internal thread, or if i have to manually put them into differents event loop in separated threads.

    Note : all data received by each socket will be stored in independant buffers (each socket has it own associated buffer), so there cannot be any thread issues (no mutex needed, etc) and all sockets would be non-blocking.

    Thank's for reading !

    NdFeB


Log in to reply