Re: WinInet API: Accessing a file on FTP for Reading [OT]
From: Gianni Mariani (gi2nospam_at_mariani.ws)
Date: 06/02/04
- Next message: Chris \( Val \): "Re: [ OT ] WinInet API: Accessing a file on FTP for Reading"
- Previous message: jeffc: "Re: I'm not REALLY a newbie, but......."
- In reply to: Rashid: "WinInet API: Accessing a file on FTP for Reading"
- Next in thread: Chris \( Val \): "Re: [ OT ] WinInet API: Accessing a file on FTP for Reading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 02 Jun 2004 10:16:33 EDT
Rashid wrote:
> I am using WinInet APIs to access a file on an FTP server (using
> InternetOpen, InternetConnect, FtpOpenFile). Before downloading, I
> want to make sure that the file I am accessing is not being written by
> any other process at the same time. If somebody is uploading a large
> file, I dont want my process to read partially-written file. I have
> tried FtpRenameFile (e.g. renaming file abc.txt to the same name
> abc.txt). This works in most cases and guarantees that no other
> process is accessing the file, but some ftp servers refuse to rename
> the file to same name. I can not change the name of the file. Is there
> a better alternative (like the one provided by CreateFile windows API
> through FILE_SHARE_READ, FILE_SHARE_WRITE flags)?
No.
Firstly, this is off-topic in c.l.c++ (and probably wine as well). It
is a question about ftp servers. I have no idea which forum is most
appropriate.
Having come across this problem in the past, the way I handled it was
that the client uploading the file would load the file with a temporary
name and once the transfer was complete, it would rename the file to
it's final name.
Your assertion that renaming of a file that is being uploaded seems to
work is probably wrong, I'm almost sure than on most unix/linux based
systems, the ftp server has no idea that the file is being uploaded and
will quite happily change the name of a currently uploaded file.
If you can, you should use an alternative, ftp is not so good regarding
concurrency.
- Next message: Chris \( Val \): "Re: [ OT ] WinInet API: Accessing a file on FTP for Reading"
- Previous message: jeffc: "Re: I'm not REALLY a newbie, but......."
- In reply to: Rashid: "WinInet API: Accessing a file on FTP for Reading"
- Next in thread: Chris \( Val \): "Re: [ OT ] WinInet API: Accessing a file on FTP for Reading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|