PDA

View Full Version : QLocalSocket Synchronicity



matic
25th March 2010, 13:04
Hi All!

In my application I used QLocalSocket to comunicate with other local processes. As soon as the socket disconnects I try to reconnect it.
What I noticed now is that the routine that tries to reconnect the socket makes it to emit the connected() signal before it ended (synchronous behavoiur). Cool.. but I was expecting it to work asynchronously (just like a QTcpSocket) and I developed my application with this constraint in mind.
In fact it happends that, given C the set of routines bound to the signal connected() and D the set of routines bound to the signal disconnected(), the program executes some of D, then all C, then the rest of D.. leading the application to an inconsistent state.

The simple question is: is there a way to force QLocakSocket to work asynchronously ?
The other is: how could I be informed about this behaviour ? I read the docs about QLocalSocket but found no mention about synchroness, so I supposed it worked like QTcpSocket (async).. I mean, where it should be written?
or maybe my application design is wrong.. something like "If you designed it well, synchronicity doesn't matter" :)

Thank you
GG