June 20, 2011

hpng hpng
Lab Rat
36 posts

QTcpSocket with signal capability

 

Hello:

I like to know if there is a way for QTcpSocket to automatically (i.e. not polling it
periodically using bytesAvailable() member function )
sends a signal when it has receive data from remote host.
So, I am looking for a signal function in QTcpSocket.

I did not see any documentation on signals emitted (when its buffer has data) by QTcpSocket.
I may have miss one. if there is any.
Thanks.

3 replies

June 20, 2011

Franzk Franzk
Lab Rat
830 posts

You should be able to connect to the readyRead() signal. It might originate from QIODevice, which means you don’t see it in the QTcpSocket documentation.

 Signature 

“Horse sense is the thing a horse has which keeps it from betting on people.”—W.C. Fields

http://www.catb.org/~esr/faqs/smart-questions.html

June 20, 2011

Tobias Hunger Tobias Hunger
Mad Scientist
3130 posts

QTcpSocket is a QAbstractSocket which is a QIODevice which has a readyRead() signal [doc.qt.nokia.com].

June 20, 2011

Andre Andre
Area 51 Engineer
6031 posts

As a general rule: if you find that some method, signal, property… that you think should obviously be in a class isn’t in the documentation for that class, you should either browse the documentation of the superclasses, or just click the “List of all members, including inherited members” link. There is a good chance you’ll find what you are looking for in (abstract) base class.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

 
  ‹‹ Using an existing DLL/Lib with Qt      How to kill a windows process if running from my Qt Application? ››

You must log in to post a reply. Not a member yet? Register here!