Results 1 to 2 of 2

Thread: Blocking ftp

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Blocking ftp

    Does anyone has any codes for blocking ftp (with timeout) implemented with QFtp?

    I need to run the ftp in batch jobs so I need to block the "get" until it is finished, along with timeout option so I can abort the job when necessary...

    I have written the BlockingFtp class (in Qt3), it works well with test codes, but in my real codes, when remote file does not exists, it blocks forever, the one-shot timeout was not even called, and the blocking event loop eats up 99% CPU....

    When the remote file exists and is large, the block runs peacefully without eating my CPU...

    I have a total of 9 files, how can I post those files for you experts to review?

    Many thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Blocking ftp

    Use signals and slots or a simple loop that checks for hasPendingCommands, like this:
    Qt Code:
    1. ftp->get(...);
    2. while(ftp->hasPendingCommands() || ftp->currentCommand()!=QFtp::None)
    3. qApp->processEvents();
    To copy to clipboard, switch view to plain text mode 

    BTW. Is it related to Qt3 or Qt4 because your profile and "related to" info say different things...

Similar Threads

  1. Non-Gui thread blocking gui
    By Valheru in forum Qt Programming
    Replies: 17
    Last Post: 12th February 2010, 11:11
  2. Replies: 8
    Last Post: 17th April 2007, 14:36

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.