Bonjour,

Vous connaissez sans doute cUrl ainsi que la lib pour .NET : http://sourceforge.net/projects/libcurl-net/

Je l'utilisais depuis un moment pour uploader des fichiers et cela sans problème.

Mais lorsque j'en suis venu a vouloir télécharger un fichier je n'y arrive pas, une partie seulement du fichier est téléchargée.

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 FileStream fs = new FileStream("myfile.bin", FileMode.Create, FileAccess.Write, FileShare.Write);
                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_URL, "ftp://127.0.0.1:21/myfile.bin");
                easy.SetOpt(CURLoption.CURLOPT_USERPWD, "anonymous:anonymous");
                easy.SetOpt(CURLoption.CURLOPT_TIMEOUT, 36000);
                easy.SetOpt(CURLoption.CURLOPT_TRANSFERTEXT, false);
                easy.SetOpt(CURLoption.CURLOPT_UPLOAD, false);
 
                CURLcode code = easy.Perform();
 
                fs.Close();
                easy.Cleanup();
 
 
...
 
 
       public Int32 OnWriteData(Byte[] buf, Int32 size, Int32 nmemb, Object extraData)
        {
            FileStream fs = (FileStream)extraData;
            fs.Write(buf, size * nmemb, nmemb);
            return (size * nmemb);
        }
Quelqu'un peut-il m'aider ?

Merci.