[Qt-interest] sockets and threads on linux

pmqt71 pmqt71 at gmail.com
Mon Feb 14 00:24:32 CET 2011


Hi Thiago,
I'd like to make the thread solution working in order to better understand
the related concepts with Qt.
It actually works on XP: threads, sockets, events... it's working very well
with hundreds of clients.

 Are you suggesting me to avoid threads with sockets for a
performance/optimization issue? or do you know about a possible problem?

thanks
pm

2011/2/13 Thiago Macieira <thiago at kde.org>

> On Sunday, 13 de February de 2011 17:42:06 pmqt71 wrote:
> > Hi all,
> > Hi Qt people, I hope the best for Qt and you!
> >
> > I have a tcp client server program working well on WinXP, but not on
> linux.
> >
> > MyTcpServer inherits from QTcpServer. the incomingConnection method
> creates
> > a new socket and moves it to a new thread. The socket is handled by
> > MyTcpSocket that inherits from QTcpSocket and implements the slots to
> manage
> > client's incoming data:
>
> Why? Why do you insist in using threads for networking I/O after I told you
> last week that you don't need to?
>
> Use the thread to do the actual processing of the data. Not for the
> networking.
>
> > On linux (Ubuntu 9.04 64bit) the readyRead signal is not fired. The
> > incomingConnection is completed with no error, the pSocket objects gets
> the
> > event ThreadChange related to the moveToThread operation. Nothing else.
> > How can I debug?
> > Qt 4.6.2
>
> First of all, upgrade.
>
> Second, debug the moveToThread call and check if the socket notifiers and
> the
> socket engine got moved to the other thread. While debugging moveToThread,
> you
> should be able to identify any children that got moved along with it.
>
> Alternatively, or in addition, you can also put some breakpoints or
> debugging
> information in the register and unregisterSocketNotifier functions in the
> event
> dispatcher classes (QEventDispatcherUNIX or QEventDispatcherGlib). You
> should
> see the socket notifier be registered for the main thread, unregistered,
> then
> re-registered in the other thread.
>
> --
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110214/cdf38e87/attachment.html 


More information about the Qt-interest-old mailing list