QT prevents FTP upload software from Crash at disconnection Point

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.