Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Starting telnet from Qt application

    General and Desktop
    3
    3
    4226
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      phamtv last edited by

      I need to start telnet on Qt application using Qprocess. I have the following implemented but it does not seem to work.

      @
      // calling function
      QStringList args;
      dbg1Socket = new QProcess(this);
      connect(dbg1Socket, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(debug1_stateChanged QProcess::ProcessState)));
      args << getIPAddress() + " 1705";
      dbg1Socket->start("telnet.exe", args);

      void test::debug1_stateChanged(QProcess::ProcessState state)
      {
      if (state == QProcess::NotRunning)
      qDebug() << "Unable to start telnet.";
      else if (state == QProcess::Starting)
      qDebug() << "Telnet starting...";
      else if (state == QProcess::Running)
      {
      qDebug() << "Telnet program started";
      connect(dbg1Socket, SIGNAL(readyReadStandardOutput()), this, SLOT(readDebug1()));
      }
      }
      @

      I always get this output -
      Telnet starting...
      Unable to start telnet.

      Can someone tell me what I am doing wrong? Thanks!

      1 Reply Last reply Reply Quote 0
      • C
        ChrisW67 last edited by

        You are passing the address and port number together as a single argument rather than the two separate arguments that "telnet" will be expecting.

        1 Reply Last reply Reply Quote 0
        • U
          uranusjr last edited by

          @
          args << getIPAddress() << QString("1705");
          @

          There may be some other arguments need to be set though. I'm not familiar with Windows's telnet command, but I did ran into some input/output redirection issues using ssh under Un*x and Plink under Windows.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post