I will try to be clear. ;)
To explain this is my trace log :
Case A
2009-11-27 08:00.00 - Copying file AAAA (1.5GB) from server 1 to server 2 (the copy will finish at 08:05:00)
2009-11-27 08:01.00 - Trying to download AAAA with curl (0.3GB) from server 2
2009-11-27 08:02.00 - Download complete
Case B
2009-11-27 08:00.00 - Copying file BBBB (3GB) from server 1 to server 2 (the copy will finish at 08:10:00)
2009-11-27 08:02.00 - Trying to download BBBB with curl (0.5GB) from server 2
2009-11-27 08:04.00 - Download complete
So when i try to download the file, it's not fully copied from server 1 but curl download it normally.
There is no system lock.
Of course when the file is fully copied on the ftp server, the download it's ok !
This my code (C#) :
Curl.GlobalInit((Int32)CURLinitFlag.CURL_GLOBAL_ALL);
FileStream fs = new FileStream("myfile.bin");
CURLcode code = CURLcode.CURLE_OK;
Easy easy = new Easy();
Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
easy.SetOpt(CURLoption.CURLOPT_WRITEDATA, fs);
easy.SetOpt(CURLoption.CURLOPT_UPLOAD, 0);
easy.SetOpt(CURLoption.CURLOPT_URL, "sftp://100.100.100.100:999");
easy.SetOpt(CURLoption.CURLOPT_USERPWD, "user:pwd");
easy.SetOpt(CURLoption.CURLOPT_TRANSFERTEXT, false);
code = easy.Perform();
easy.Cleanup();
fs.Close();
Curl.GlobalCleanup();
private Int32 OnWriteData(Byte[] buf, Int32 size, Int32 nmemb, Object extraData)
{
FileStream fs = (FileStream)extraData;
fs.Write(buf, 0, size * nmemb);
fs.Flush();
return (size * nmemb);
}
> To: curl-library_at_cool.haxx.se
> Subject: Re: Downloading a file
> From: marco.maggi-ipsu_at_poste.it
> Date: Thu, 26 Nov 2009 20:37:29 +0100
>
> "Paul Monteiro" wrote:
> > I'm using curl-7.19.7 to download a large file ~ 1.5GB. I
> > scan a SFTP directory every 10 seconds and when the file
> > is here i download the file.
>
> So far it is clear.
>
> > But when i download the file the size is not the same on
> > the local and remote machine. It's because the remote
> > file is copying from a slower hard disk. So the file is
> > not full copied !
>
> If possible, post a bit of the code you are using to
> download the file with curl; else it is difficult understand
> if your code is correct. For example: Are you using the
> easy or the multi API? Does downloading with the "curl"
> program work fine?
>
> > The file must be locked by the system but not by the SFTP
> > server !
>
> This is unclear.
> --
> Marco Maggi
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
_________________________________________________________________
Nouveau ! Tout Windows Live débarque dans votre téléphone. Voir les Windows phone
http://clk.atdmt.com/FRM/go/175819071/direct/01/
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-27