Results 1 to 2 of 2

Thread: QFtp Resume Upload

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    7
    Thanks
    1

    Exclamation QFtp Resume Upload

    Hi, i need to implement a ftp client that has a resume upload feature using QFtp.

    I have tried implementing the resume function using raw commands ... something like the following:

    Qt Code:
    1. ftp->rawCommand("TYPE I");
    2. ftp->rawCommand("PASV");
    3. ftp->rawCommand("REST" + x); //where x is the string with the position ...
    4. ftp->rawCommand("STOR" + remoteFileName);
    To copy to clipboard, switch view to plain text mode 

    however i am getting the following error:

    425 :: "Can't open data connection."

    I have looked over the QFtp sourcefile and i saw that the ftp data channel isn't opened when using raw commands.
    I have tried opening a data channel using a QTcpSocket like this :

    Qt Code:
    1. void FtpClass::onRawCmdReply(int replyCode, const QString & detail )
    2. {
    3. qDebug() << replyCode << " :: " << detail;
    4.  
    5. if (replyCode == 227) // detail = Entering Passive Mode (a1,a2,a3,a4,p1,p2)
    6. // host = a1.a2.a3.a4
    7. // port = p1*256 + p2
    8. {
    9. QRegExp addrPortPattern(QLatin1String("(\\d+),(\\d+),(\\d+),(\\d+),(\\d+),(\\d+)"));
    10. if (addrPortPattern.indexIn(detail) == -1)
    11. {
    12. {
    13. qDebug("QFtp: bad 227 response -- address and port information missing");
    14. }
    15. }
    16. else
    17. {
    18. _dataSocket = new QTcpSocket(this);
    19. QStringList lst = addrPortPattern.capturedTexts();
    20. QString host = lst[1] + QLatin1Char('.') + lst[2] + QLatin1Char('.') + lst[3] + QLatin1Char('.') + lst[4];
    21. quint16 port = (lst[5].toUInt() << 8) + lst[6].toUInt();
    22. _dataSocket->connectToHost(host, port);
    23. if (!_dataSocket->waitForConnected(1000))
    24. {
    25. qDebug() << "cannot connect to: " << host << "port :" << port;
    26. }
    27. else
    28. {
    29. qDebug() << "connected to: " << host << "port :" << port;
    30. }
    31. }
    32. }
    33. }
    To copy to clipboard, switch view to plain text mode 


    But if i do that i get the following error :

    426 :: "Connection closed; transfer aborted."

    It is not a server issue since i've tested using a random ftp client and the server supports resuming.
    Also it is not a firewall issue since i dissabled the firewalls on both machines.

    What am i doing wrong ? can someone help me please?

  2. #2
    Join Date
    Dec 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFtp Resume Upload

    no one suggestion??((

Similar Threads

  1. QFtp and non-Latin1 FTP servers
    By miwarre in forum Qt Programming
    Replies: 1
    Last Post: 3rd August 2009, 12:44
  2. QFTP resume download
    By wagui in forum Qt Programming
    Replies: 9
    Last Post: 14th March 2008, 14:15
  3. how to use qftp to upload file in just one procedure?
    By cxl2253 in forum Qt Programming
    Replies: 4
    Last Post: 23rd April 2007, 09:57
  4. why the qftp failed in qmainwindow?where is its signal?
    By cxl2253 in forum Qt Programming
    Replies: 15
    Last Post: 22nd April 2007, 13:51
  5. qftp in qthread canot upload file
    By cxl2253 in forum Qt Programming
    Replies: 16
    Last Post: 7th April 2007, 02:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.