[Qt-interest] problems with QTcpSocket

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Fri Jan 9 10:40:03 CET 2009


Victor Minuesa Cuenca wrote on Friday, January 09, 2009 10:07 AM:

> ...
> I'm working on a project that connects to my pc with another pc, not
> blocking signals using TCP. But my problem is that the socket timeout
> is very big.

Is this of any use to you (for example)?

  http://doc.trolltech.com/4.4/qabstractsocket.html#waitForConnected

Alternatively you could always start a QTimer before the time-consuming method, e.g.

  http://doc.trolltech.com/4.4/qtimer.html#singleShot

and once it fires (signal 'timeout'), check in your slot if the time-consuming method is still not finished, and if not, terminate it. The QTimer lets you set any timeout you wish.

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22




More information about the Qt-interest-old mailing list