[Qt-interest] QTcpSocket suddenly disconnects
Andre Somers
andre at familiesomers.nl
Wed Aug 5 09:44:44 CEST 2009
Joshua Senecal wrote:
>
> So, I think what's happening in a nutshell is the code that executes as
> a result of the original server disconnection is not given a chance to
> execute completely before my reconnect routines begin execution. I'll
> have to see what I can do to remedy this.
>
>
A simple delayed invocation comes to mind here. Either use a singleshot
timer with a very short (0?) timeout, or invoke your reconnect slot (if
it is not a slot, make it one) using QMetaObject::invokeMethod with the
Qt::QueuedConnection connection type. Of course you can also send a
custom event to yourself, but that is probably more complex and unneeded.
André
More information about the Qt-interest-old
mailing list