I have a console application that looks for a device on the network and gets data from it. It will either get the data within a few seconds or it get stuck in trying to receive data.

So I wanted to set up a Qtimer that would preform a quit after 10 seconds. Here is my code but it does not seem to work.

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QCoreApplication a(argc, argv);
  4.  
  5. QTimer::singleShot(10000, &a, SLOT(quit()));
  6.  
  7. // either will return within 3 seconds or get stuck trying to do a read.
  8. LLDP::Execute();
  9.  
  10. return a.exec();
  11. }
To copy to clipboard, switch view to plain text mode 

It is pretty much exactly what is in the singleShot documentation. My code is where the "..." are.

Qt Code:
  1. #include <QApplication>
  2. #include <QTimer>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication app(argc, argv);
  7. QTimer::singleShot(600000, &app, SLOT(quit()));
  8. ...
  9. return app.exec();
  10. }
To copy to clipboard, switch view to plain text mode 

What am I doing wrong and what is the correct way?