• 6593阅读
  • 4回复

[提问]qftp与qtcpsocket [复制链接]

上一主题 下一主题
离线jiang_198586
 

只看楼主 倒序阅读 楼主  发表于: 2011-09-22
一个程序中,qtcpsocket作为一个线程一直运行着,我在主程序中执行qftp下载,为什么提示了下载成功,但是下载的文件是空的呢?关闭程序时提示QAbstractSocket::connectToHost() called when already looking up or connecting to。。。。
难道一个程序中qftp和qtcpsocket不能同时连接同一个ip地址吗?
离线begboy

只看该作者 1楼 发表于: 2011-09-22
请教楼主:
我用
ftp->connetcToHost("10.13.9.140",21);
if(ftp->state()==QFtp::Unconnected)
{
      QDebug() << "connect fail!!\n";
}
总是提示connect fail!!,请问楼主如何解决?
(我用控制台方式ftp 10.13.9.140没有任何问题)
谢谢!


离线begboy

只看该作者 2楼 发表于: 2011-09-22
回 楼主(jiang_198586) 的帖子
补充一下:
我用qtcpsocket中ip地址和端口21没有问题。
另服务器用vsftpd。
用Linux和Win的Qt编写均返回无法连接。
谢谢!

目前我用Qprocess替代实现,但希望查出什么问题。
离线wxj120bw

只看该作者 3楼 发表于: 2011-09-23
回 1楼(begboy) 的帖子
手册里的信息
All of these commands return a unique identifier that allows you to keep track of the command that is currently being executed. When the execution of a command starts, the commandStarted() signal with the command's identifier is emitted. When the command is finished, the commandFinished() signal is emitted with the command's identifier and a bool that indicates whether the command finished with an error.
离线begboy

只看该作者 4楼 发表于: 2011-09-23
回 3楼(wxj120bw) 的帖子
首先感谢W兄!
看来我要认真看看QFTP的同步和异步使用方法。
谢谢!
快速回复
限100 字节
 
上一个 下一个