QT 防止FTP 上传软件在断连处 Crash
前段时间发现项目中的上传FTP软件有可能会在从服务器申请断连时Crash, 所以加了一个Timer。
由于项目代码行数过大, 此处上传部分代码片段。
timeoutTimer = new QTimer();
connect(timeoutTimer, SIGNAL(timeout()), this, SLOT(doTimeout()));
timeoutTimer->setInterval();
case QFtp::Closing:
// The connection is closing down, but it is not yet closed. (The state will be Unconnected when 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::doTimeout()
{
pMain->debug("debug154545 timeout !!!!!!!");
pMain->sendProxyMessage("MesUPLOADTimeout", ProxyMessage::Notify);
timeoutTimer->stop();
}
在此进程发出MesUPLOADTimeout 信息之后, 项目主进程会从代理Proxy中接受此信息并进行处理。
/**
*@projectName BoeB9Project
*@author Hasan
**/
void BoeB9QtmCellInlineMain::restartUploader()
{
QProcess proc;
QString c = "taskkill /im uploader.exe /f";
proc.execute(c);
proc.close(); info("********info terminate uploader"); QProcess *proc1 = new QProcess(this); proc1->start("cmd.exe", QStringList() <<"/c" << "c:///ORBKwsmcu/bin/start_uploader.bat"); delete proc1; info("********info start uploader again");
}
主进程重启上传软件,从而跳过断连。
QT 防止FTP 上传软件在断连处 Crash的更多相关文章
- FlashFXP(强大的FXP/ftp上传工具)V5.0.0.3722简体中文特别版
flashfxp是功能强大的fxp/ftp软件,融合了一些其他优秀ftp软件的优点,如像cuteftp一样可以比较文件夹, FlashFXP是一款功能强大的FXP/ftp上传工具, FlashFXP集 ...
- Jenkins通过FTP上传站点太多文件导致太慢且不稳定,切换为压包上传再解压的思路(asp.net)
在本地先处理好要上传的站点文件之后,可能会因为一些网页切图导致ftp上传不稳定,中断,或者文件占用的问题. 那么换了一种实现思路,要借助jenkins的工具jenkins-cli.jar. 解决思路: ...
- QNetworkAccessManager 实现的 ftp 上传
使用 QNetworkAccessManager 实现的 ftp 上传代码.完整可用,做个备忘. #include "mainwindow.h" #include <QDeb ...
- FTP上传下载工具(FlashFXP) v5.5.0 中文版
软件名称: FTP上传下载工具(FlashFXP) 软件语言: 简体中文 授权方式: 免费试用 运行环境: Win 32位/64位 软件大小: 7.4MB 图片预览: 软件简介: FlashFXP 是 ...
- java客户端调用ftp上传下载文件
1:java客户端上传,下载文件. package com.li.utils; import java.io.File; import java.io.FileInputStream; import ...
- FTP上传和WEB上传的区别
说区别之前,咱先说说什么是上传?上传就是将信息从个人计算机(本地计算机)传递到中央计算机(远程计算机)系统上,让网络上的人都能看到.将制作好的网页.文字.图片等发布到互联网上去,以便让其他人浏览 ...
- .net FTP上传文件
FTP上传文件代码实现: private void UploadFileByWebClient() { WebClient webClient = new WebClient(); webClient ...
- 通过cmd完成FTP上传文件操作
一直使用 FileZilla 这个工具进行相关的 FTP 操作,而在某一次版本升级之后,发现不太好用了,连接老是掉,再后来完全连接不上去. 改用了一段时间的 Web 版的 FTP 工具,后来那个页面也 ...
- FTP上传文件到服务器
一.初始化上传控件. 1.我们这里用dropzone.js作为上传控件,下载地址http://www.dropzonejs.com/ 2.这里我们使用一个div元素作为dropzone载体. < ...
随机推荐
- node定时任务
var schedule = require('node-schedule') require('shelljs/global'); function scheduleCronstyle(){ sch ...
- Angular1组件通讯方式总结
这里需要将Angular1分为Angular1.5之前和Angular1.5两个不同的阶段来讲,两者虽然同属Angular1,但是在开发模式上还是有较大区别的.在Angular1.4及以前,主要是基于 ...
- OpenLayers中的图层(转载)
作者:田念明出处:http://www.cnblogs.com/nianming/本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法 ...
- python链接安卓 跳一跳
借鉴: 一百行代码实现微信跳一跳 之前需要安装adb 开启服务: adb nodaemon server 显示设备: adb devices 代码: import math import os im ...
- SQL Server ->> SQL Server 2016新特性之 -- Dynamic Data Masking
Dynamic Data Masking是为了防止敏感数据暴露给未经授权的用户,以一种最小开销和维护成本的形式.Dynamic Data Masking用于表的字段,相当于盖住字段数据的一部分.比如一 ...
- notepad ++ 编辑 powershell profile 文件时的诡异问题
使用notepad 编辑 C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1 时,记事本打开和用notepad++打开显示的内容居然不一样. ...
- dbms_randon package
reference to wbsite:http://zhangzhongjie.iteye.com/blog/1948930#comments DBMS_RANDON PACKAGE: Define ...
- 1100 final standings
http://acm.timus.ru/problem.aspx?space=1&num=1100 link to the problem make a fast stable sorting ...
- Ace admin 如何实现类似于freamset加载页面
如上标题所述,ace admin做后台页面的时候,可以实现类似于用freamset的功能,但是ace admin做的比freamset更好,他可以用异步加载的形式展示,而加载的页面的内容可以尽可能的少 ...
- stl sort使用不当造成崩溃
#include <iostream>#include <vector>#include <algorithm>using namespace std; bool ...