Some time ago found that the upload FTP software in the project might be crash when requesting a disconnection from the server, so a timer was added.
Some code snippets are uploaded here because of the large number of project code lines.
New Qtimer (); This , SLOT (Dotimeout ())); Timeouttimer->setinterval (4000);
case qftp::closing: // The connection is closing down, but it's not yet closed. (The state would be unconnected if the connection is closed.) Pmain->debug ( " status (%d) = disconnecting from HOST , type); Timeouttimer ->start (); break ;
case qftp::unconnected: // There is no connection to the host. Pmain->debug ( " status (%d) = disconnected Status , type); if (Communicator->isperforming ()) { Communicator ->abortrequest (); // abort performing command, maybe done (ERROR) should be called later } timeouttimer ->stop (); // stop timer break ;
/* * * @projectName boeb9project * @author Hasan **/void Ftphelper::d otimeout () { pmain->debug ("debug154545 timeout!!!!!!! " ); Pmain->sendproxymessage ("mesuploadtimeout", Proxymessage::notify ); Timeouttimer-Stop ();}
After this process issues mesuploadtimeout information, the project master process accepts this information from proxy proxies and processes it.
/** * @projectName boeb9project * @author Hasan **/voidBoeb9qtmcellinlinemain::restartuploader () {qprocess proc; QString C="taskkill/im uploader.exe/f"; Proc.execute (c); Proc.close (); Info ("********info Terminate uploader"); Qprocess*proc1 =NewQprocess ( This); Proc1->start ("Cmd.exe", Qstringlist () <<"/ C"<<"C:///orbkwsmcu/bin/start_uploader.bat"); DeleteProc1; Info ("********info start uploader again");}
The main process restarts the upload software, thus skipping the connection.
QT prevents FTP upload software from Crash at disconnection Point