There is QFtp::list() available (since OP is using QFtp anyway).
There is QFtp::list() available (since OP is using QFtp anyway).
There you go pointing the OP straight at it... I was trying to be more subtle by saying that QFtp had functions for both and that some RTFM action might be needed.
Ouch, sorry.. didn't read your post carefully enough... Still one has to read the docs to learn how to process the response QFtp receives.
Could you please expand OP and RTFM and please let me know how to interpret it. Thanks.
Added after 5 minutes:
While fetching the data I am using QFtp::get and if the operation returned 'error' true for QFtp::CommandFinished(int, bool error) then the rest of QFtp commands are not executing. Since all the ftp commands are asynchronous, if one of the command fails does the remaining rest following them aborts ?, because my program does not do anything if any one of the ftp command returns 'error'.
Last edited by nikhilqt; 16th February 2012 at 21:24.
OP is "original poster" (meaning you). RTFM is... well... STFW for it
The Jargon File
From the friendly manual for QFtp (you have read it, haven't you?)...
If an error occurs during the execution of one of the commands in a sequence of commands, all the pending commands (i.e. scheduled, but not yet executed commands) are cleared and no signals are emitted for them.
Oh! it is there in the documentation. I didn't see it hard enough. So now it creates a issue for me for even 'ls filename' command, because the remaining QFtp::get(...) requests would be lost since the former command fails if the file is not present.
Why? If the list command fails there is no file to download. If you a queuing several file list/get commands at once, don't.
I expect the list command will not fail if the file does not exist: it should just return no directory entries. (I have not verified that)
nikhilqt (27th February 2012)
But my requirement is to check whether that specific file exists or not in that folder. I cannot achieve it using list command. So as you said I used 'ls filename'.
There are some 40-50 files I need to download and this number might increase as well. So I queue up the request of all the raw command('ls filename') for all the files.Why? If the list command fails there is no file to download. If you a queuing several file list/get commands at once, don't.
My approach was to check the error status of all the raw commands and then selectively call the QFtp::get method only for those files which exists. But here the checking queue is itself failing for me.![]()
Why not?
Don't do that then. Store the file data elsewhere and push commands to the ftp client as you begin processing a particular entry.There are some 40-50 files I need to download and this number might increase as well. So I queue up the request of all the raw command('ls filename') for all the files.
nikhilqt (27th February 2012)
Thanks. I made it work. In the process, I observed one more situation, where the QFtp::Get command will be running and there won't be write to the file in the local file system. This happens quite a sometime after the download of some 20-30 files. Is this because ftp has timeout and the state is been disconnected ?
If I close the application and start it again, then the downloading starts normally. Have anybody experienced this behavior ?
Last edited by nikhilqt; 27th February 2012 at 20:09.
Guys, Any help regarding this. Is there any timeout for the QFtp::Get command. Or do i need to close the ftp connection after sometime and need to re-initiate it ? Please share me your thoughts on it. Thanks
I think you are adressing the question in the wrong place. If you want to learn how FTP servers work, then learn about FTP. Qt has nothing to do with this. Your "issue" is stricly FTP related from the very beginning.
Bookmarks