[Qt-interest] Socket communication without threads

Thiago Macieira thiago.macieira at trolltech.com
Tue Mar 3 08:07:39 CET 2009


Predrag Manojlovic wrote:
>Hi,
>
>Often i hear that threads should be avoided in qt socket applications.

No, that's not the recommendation. We're saying you don't *have* to use 
threads for sockets in Qt. Unlike Java sockets, Qt sockets operate 
asynchronously and in non-blocking mode. So you can operate them without 
resorting to the one-thread-per-socket approach found in Java.

Whether you need threads for other reasons, that's entirely up to your 
specific use-case. We can't generalise.

>I'm not sure is that possible always.
>I'm mostly creating applications like TCP chat client/server.
>
>Questions:
>1. Is there any way to create chat server without using threads?

Of course.

>2. why is that better?

Instead of answering, I ask you: why is using threads better?

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090302/2bdb7367/attachment.bin 


More information about the Qt-interest-old mailing list