i just modify the code like this :
MainWindow::~MainWindow()
{
delete ui;
delete mysocket;
}
void MainWindow::on_pushButton_clicked()
{
QFile ipfile
("/home/dousdou/tech-ip.txt");
{
qDebug("Can't open file");
return;
}
while (!ipfile.atEnd())
{
iplist.append(ipfile.readLine());
}
ipfile.close();
for(int i=0;i<iplist.count();++i)
{
connect(mysocket,SIGNAL(connected()),this,SLOT(on_connected()));
mysocket->connectToHost(iplist.at(i), 22);
}
}
{
msgBox.
setText("Not connected " + QString::number(socketError
));
msgBox.exec();
}
void MainWindow::on_connected()
{
msgBox.setText("It's ok. Connected");
msgBox.exec();
mysocket->disconnectFromHost();
}
MainWindow::~MainWindow()
{
delete ui;
delete mysocket;
}
void MainWindow::on_pushButton_clicked()
{
QFile ipfile("/home/dousdou/tech-ip.txt");
if(!ipfile.open(QIODevice::ReadOnly))
{
qDebug("Can't open file");
return;
}
QStringList iplist;
while (!ipfile.atEnd())
{
iplist.append(ipfile.readLine());
}
ipfile.close();
for(int i=0;i<iplist.count();++i)
{
connect(mysocket,SIGNAL(connected()),this,SLOT(on_connected()));
connect(mysocket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(on_error(QAbstractSocket::SocketError)));
mysocket->connectToHost(iplist.at(i), 22);
}
}
void MainWindow::on_error(QAbstractSocket::SocketError socketError)
{
QMessageBox msgBox;
msgBox.setText("Not connected " + QString::number(socketError));
msgBox.exec();
}
void MainWindow::on_connected()
{
QMessageBox msgBox;
msgBox.setText("It's ok. Connected");
msgBox.exec();
mysocket->disconnectFromHost();
}
To copy to clipboard, switch view to plain text mode
and he show me this error:
QMetaObject::connectSlotsByName: No matching
signal for on_connected
() QAbstractSocket::connectToHost() called when already looking up or connecting
/connected to
"10.20.24.157 "
QAbstractSocket::connectToHost() called when already looking up or connecting
/connected to
"192.168.1.5 "
QAbstractSocket::connectToHost() called when already looking up or connecting
/connected to
"10.20.24.155 "
QMetaObject::connectSlotsByName: No matching signal for on_connected()
QMetaObject::connectSlotsByName: No matching signal for on_error(QAbstractSocket::SocketError)
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "10.20.24.157
"
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "192.168.1.5
"
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "10.20.24.155
"
To copy to clipboard, switch view to plain text mode
where is the rpb hier i know that's i'm not good in devlopment but plz i need your help i can work lonly and you are my last chance
Bookmarks