Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Is "QSocket notifiers cannot be enabled or disabled from another thread" warning bad?
I am using a socket in multiple threads and when using i get this warning message"QSocket notifiers cannot be enabled or disabled from another thread". Though the data is sent and received through that socket without any problem, i am concerned about the warning. Can anyone tell whether it is safe to neglect that warning?
JonB last edited by
I'm not an expert. While you wait for one here, I think you should read through the admonitions in https://stackoverflow.com/questions/36065240/using-qtcpsockets-through-different-threads.
Can anyone tell whether it is safe to neglect that warning?
probably not, but no-one can stop you.
But do tell, why are you carrying the mountain to the prophet, instead of letting the prophet walk himself ?
What I mean, make one socket handling class, use signals to transmit the data you want to send via TcpSocket, return the received data also via Signals emitted from the tcpsocket thread. Don't carry your socket around, especially across multiple threads.
ManiRon last edited by ManiRon
along with this can you clarify the below doubt which i asked in QT forum
@ManiRon I would, but I can't help you there, that has to be/should be done with a regular expression.
For me regular expressions are magic, and I'm a Muggle.
It would also be nice to show how exactly you are using that socket from multiple threads.
I created seperate thread for manage tcp operations(connect, disconnect,write, read). and put that thread in exec(). and the used signals and slot method to communicate between the threads. and the error which i mentioned is not coming now .
JonB last edited by JonB
waitForReadyRead()is at best "dodgy" under Windows --- you have never said what platform you are on --- and has threading implications. Have a read through e.g. https://stackoverflow.com/questions/44544684/is-it-ok-to-use-waitforreadyread-instead-of-creating-a-slot-for-readyread. Why do you need it all, when you could design to be signal/slot instead which is better?