Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.1k views
in .NET FTP by
I use edtftpnet for almost a year in my project. i use edtftpnet-1.0.1, Mono and GTK#.

My FTP stuff read byte[] and send it back on the network via FTP
So i use PutDataSize to keep sending data to the destination file.
Now if you look at the new version form edtftpnet-1.0.3 to edtftpnet-1.1.6, this function doesn't exist anymore.

How can i easily send byte over the network?

The append file function is working but the stream is create each time so it is very slow.
Here is the code. The full source can be found at :
http://cvs.sourceforge.net/viewcvs.py/x ... iew=markup

If i am asking question about edtftpnet, it is because i have a network write failure in the code below when using use edtftpnet-1.0.1 and Mono<= 1.0.2. And i really don't undestand why and i would like some advice.

Thanks

         // Create buffer
         int chunksize = 4096;
         byte[] chunk = new byte[chunksize];
         int size = (int)cur.size;
         bool start = true;
         
         // read from stream iso & write to file in chunks
         while(size > 0)
         {
            //Console.WriteLine("Size =[" + size +"]");
            if (size > chunksize)
            {
               size -= chunksize;
               sendsize += chunksize;
               xisoReader.BaseStream.Read(chunk, 0, chunksize);
               if (ISOAction == ExtractISO.ftpavalaunch)
                  streamnetwork.Write(chunk, 0, chunksize);
               else if (ISOAction == ExtractISO.ftp)
               {
                  if (start == true)
                  {
                     start = false;
                     ftp.PutDataSize(chunk, cur.fname, chunksize, true, false);
                  }
                  else
                     ftp.PutDataSize(chunk, cur.fname, chunksize, false, false);
               }
               else if (ISOAction == ExtractISO.hdd)
                  writerfile.Write(chunk, 0, chunksize);
            }
            else
            {
               xisoReader.BaseStream.Read(chunk, 0, size);
               if (ISOAction == ExtractISO.ftpavalaunch)
                  streamnetwork.Write(chunk, 0, size);
               else if (ISOAction == ExtractISO.ftp)
               {
                  if (start == true)
                  {
                     start = false;
                     ftp.PutDataSize(chunk, cur.fname, size, true, true);
                  }
                  else
                     ftp.PutDataSize(chunk, cur.fname, size, false, true);
               }
               else if (ISOAction == ExtractISO.hdd)
                  writerfile.Write(chunk, 0, size);
               size -= size;
               sendsize += size;
            }
         }


Thanks for your advice and your time.
kaya

Please log in or register to answer this question.

Categories

...