To add up to what was posted You could either use QProcess with ping and check result or simply:
void MainWindow::someFunction(){
connect( sock, SIGNAL(hostFound()), this, SLOT( checkFile() ) );
sock->connectToHost( "192.168.0.2", 421 );
}
void MainWindow::checkFile()
{
qDebug
() <<
"File Exists?:" <<
QFile::exists( "\\192.168.0.2\foo\bar.txt" );
}
void MainWindow::someFunction(){
QTcpSocket *sock = new QTcpSocket( this );
connect( sock, SIGNAL(hostFound()), this, SLOT( checkFile() ) );
sock->connectToHost( "192.168.0.2", 421 );
}
void MainWindow::checkFile()
{
qDebug() << "File Exists?:" << QFile::exists( "\\192.168.0.2\foo\bar.txt" );
}
To copy to clipboard, switch view to plain text mode
or beter use SIGNAL( stateChanged(QAbstractSocket::SocketState) )
Its add a few lines to Your code and is IMHO simple.
Bookmarks