LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Qt: Automated monitoring of different sockets for available data (https://www.linuxquestions.org/questions/programming-9/qt-automated-monitoring-of-different-sockets-for-available-data-860717/)

Aquarius_Girl 02-04-2011 10:20 AM

Qt: Automated monitoring of different sockets for available data
 
nextPendingConnection () returns a new socket with respect to a new client.
This new QSocket is passed to the connect () function which connects it to a SLOT 'xyz' with SIGNAL 'readyRead()'.

Now in the SLOT 'xyz' how I am supposed to automate the monitoring of ALL connected sockets to see whether some data is available on them?

One pathetic way would be to run all the sockets through a for loop and check each one of them for the data.

Secondly, I read up on QSocketNotifier() here: http://doc.qt.nokia.com/4.7-snapshot...SocketNotifier

But I am not sure if that is the correct thing, please guide.

theNbomr 02-04-2011 11:20 AM

I'm not well acquainted with Qt, but reading between the lines, it sounds like you are setting up various connections with signal handlers to handle the incoming data. This is a method to avoid the problem of 'monitoring of ALL connected sockets to see whether some data is available on them'. It sounds like you are inventing a problem which has already been avoided.

--- rod.

Aquarius_Girl 02-04-2011 07:03 PM

Thanks for replying, but somewhere I have to call the read function w.r.t the socket on which data is available, que is the read func. should be called for which socket if there are 10 of them?

Aquarius_Girl 02-06-2011 02:55 AM

SOLUTION:

http://doc.qt.nokia.com/4.7-snapshot/qsignalmapper.html


All times are GMT -5. The time now is 02:23 PM.