Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Starting telnet from Qt application

Starting telnet from Qt application

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 4.6k Views 1 Watching
  • 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 Offline
    P Offline
    phamtv
    wrote on last edited by
    #1

    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
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      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
      0
      • U Offline
        U Offline
        uranusjr
        wrote on last edited by
        #3

        @
        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
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved