Starting telnet from Qt application
I need to start telnet on Qt application using Qprocess. I have the following implemented but it does not seem to work.
// calling function
dbg1Socket = new QProcess(this);
connect(dbg1Socket, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(debug1_stateChanged QProcess::ProcessState)));
args << getIPAddress() + " 1705";
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 -
Unable to start telnet.
Can someone tell me what I am doing wrong? Thanks!
You are passing the address and port number together as a single argument rather than the two separate arguments that "telnet" will be expecting.
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.