Quote Originally Posted by liam0connor View Post
i might sound like a newbie but what response would i get from the the waits?
The waitForXYZ methods return true if the signal has been emitted or false if that was not the case.

Quote Originally Posted by liam0connor View Post
And do you have any idea as to how i could change to code to maybe try non blocking communication
By connecting to the signals instead of using the waitFor methods.

Usually the pattern is a "Command" or "Job", an object that encapsulates the steps necessary to achieve the goal.

Something like
Qt Code:
  1. class RebootCommand : public QObject
  2. {
  3. Q_OBJECT
  4. public:
  5. explicit RebootCommand(QObject *parent = nullptr);
  6.  
  7. void start(const QString &host, int port);
  8.  
  9. signals:
  10. void finished();
  11.  
  12. private slots:
  13. void onConnected();
  14. void onReadyRead();
  15.  
  16. private:
  17. enum State {
  18. Disconnected,
  19. WaitingForUserPrompt1,
  20. WaitingForPasswordPrompt1,
  21. WaitingForUserPrompt2,
  22. WaitingForPasswordPrompt2
  23. };
  24. State m_state = Disconnected;
  25.  
  26. QTcpSocket *m_socket = nullptr;
  27. };
To copy to clipboard, switch view to plain text mode 

Cheers,
_