Re: Help. In ftp sessions, how to refresh directory list?
- From: Pops <dude@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 10 Nov 2007 22:29:26 -0500
This was for the PUT process. The coder of the example inline comment probably means that if you are doing any directory listing, it needs be refresh (listed again) in order to see the posted file. It is probably just a comment because this example was pulled from a more extensive example.
For example, if you wrote a FTP GUI program and you started it, connected to a ftp site, it will most likely start by listing the current directory. So you begin a PUT process, and having his note on the on the successful return TRUE, probably triggers a GUI refresh of the directory so you can see the newly posted file.
Same would true for any change in the directory (delete or rename). If successful, you should update the current directory listing. If FALSE, there is no need to refresh it because nothing changed.
The whole idea is akin to the typical console method:
ftp> DIR <---- list the directory
ftp> PUT afile <--- put a file
ftp> DIR <----- relist it to see the new file
For the WININET.DLL library, the FTP user command "DIR" translates to a FTP SERVER "LIST" command, and to WININET.DLL does an emulation of the FindFirstFile()/FindNextFile()/FindClose() APIs.
It is a SNAP SHOP, meaning, it does the ftp LIST in the background and then parses each ftp server response line which can be in various formats, to produce an internal list of WIN32_FIND_DATA records.
It begins this process with FtpFindFirstFile() and the successful return results with the first record from the WIN32_FIND_DATA internal list, and when you call InternetFindNextFile(), it gets the next record in the list, and so on. In the end, you InternetCloseHandle() to clean up the process.
--
HLS
Larry wrote:
I read a document about FTP Sessions in MSDN..
http://msdn2.microsoft.com/en-us/library/aa384180.aspx
In the document, if you upload a file to FTP server, delete or rename
a file on FTP server, you need to remember to refresh directory
listing.
In the sample source code there is just a comment: // Remember to
refresh directory listing. But how to do it in C++? Just send a LIST
ftp command or use FtpFileFinder to enumerate the files on FTP
server?
Laurence
- References:
- Prev by Date: Re: find the largest 1000 values
- Next by Date: Re: heap
- Previous by thread: Re: Help. In ftp sessions, how to refresh directory list?
- Next by thread: Help. In ftp sessions, how to refresh directory list?
- Index(es):
Relevant Pages
|
|