bool programMain::serverConnect() {
//make the tunnel channel display:
tunnel.
setProcessChannelMode(QProcess::SeparateChannels);
tunnel.
setReadChannel(QProcess::StandardOutput);
//spawn the SSH tunnel:
tunnel.start("c:/progra~1/PuTTY/plink.exe -l user -ssh -pw password -C -v -N -L 9999:111.111.111.111:9999 remotecomputer.domain.com");
//open SSH tunnel
if (!tunnel.waitForStarted(20000)) {
QMessageBox::critical(0, qApp
->tr
("Could not open SSH Tunnel"),
qApp
->tr
("Unable to create secure ssh tunnel!\n\n")+ qApp
->tr
("\n\nClick Cancel to exit."),
QMessageBox::Cancel,
return false;
}
//hold the database login until the tunnel has responded with a login message:
if (!tunnel.waitForReadyRead(20000)) {
QMessageBox::critical(0, qApp
->tr
("SSH connection not responding!"),
qApp
->tr
("SSH response timed out!\n\n")+ qApp
->tr
("\n\nClick Cancel to exit."),
QMessageBox::Cancel,
return false;
}
//connect to the server:
if (!createConnection(login.serveraddy, login.databasename, login.username, login.password, login.port)) {
return false;
}
return true;
}
bool programMain::serverConnect() {
//make the tunnel channel display:
tunnel.setProcessChannelMode(QProcess::SeparateChannels);
tunnel.setReadChannel(QProcess::StandardOutput);
//spawn the SSH tunnel:
tunnel.start("c:/progra~1/PuTTY/plink.exe -l user -ssh -pw password -C -v -N -L 9999:111.111.111.111:9999 remotecomputer.domain.com");
//open SSH tunnel
if (!tunnel.waitForStarted(20000)) {
QMessageBox::critical(0, qApp->tr("Could not open SSH Tunnel"),
qApp->tr("Unable to create secure ssh tunnel!\n\n")+ qApp->tr("\n\nClick Cancel to exit."), QMessageBox::Cancel,
QMessageBox::NoButton);
return false;
}
//hold the database login until the tunnel has responded with a login message:
if (!tunnel.waitForReadyRead(20000)) {
QMessageBox::critical(0, qApp->tr("SSH connection not responding!"),
qApp->tr("SSH response timed out!\n\n")+ qApp->tr("\n\nClick Cancel to exit."), QMessageBox::Cancel,
QMessageBox::NoButton);
return false;
}
//connect to the server:
if (!createConnection(login.serveraddy, login.databasename, login.username, login.password, login.port)) {
return false;
}
return true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks