[Qt-interest] problem using sockets and threads

pmqt71 pmqt71 at gmail.com
Wed Feb 9 17:05:29 CET 2011


So I could use socket's signal-slots, bytesAvailable, waitForReadyRead
etc.. to achieve non-blocking I/O, right?

But I think I should avoid instructions like:

    while (pSocket->bytesAvailable() < blockSize) {
        if (!pSocket->waitForReadyRead(timeout)) {
            ...

because a slow client may take time to send the entire message causing
the other to wait (this is the reason why I was using threads). Of
course if you have other hints...

I'm trying.
thanks
pm


2011/2/9 Thiago Macieira <thiago at kde.org>:
> On Tuesday, 8 de February de 2011 23:47:00 pmqt71 wrote:
>>  AFAIK in a single threaded socket app, a slow
>> client will degrade performances for all the clients.
>> Is Qt able to provide a kind of socket IO parallelism with no threads?
>
> Of course. Asynchronous and non-blocking I/O have been done on Unix since the
> dawn of time (well, of time_t anyway).
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>  Senior Product Manager - Nokia, Qt Development Frameworks
>      PGP/GPG: 0x6EF45358; fingerprint:
>      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>



More information about the Qt-interest-old mailing list