c# - Moving compressed file from one computer to another -


my project ftp, , need help.
1. i'm using huffman code compress file , send computer asking file.

the function huffman code returns byte array.
don't understand how send bytes.

i have function:

    private void upload(string namefile)     {         try         {             fileinfo ftemp = new fileinfo(clientform.sharedfolderpath + "\\" + namefile);   // file name             long total = ftemp.length;              // size of file in long             long rdby = 0;             int len = 0;                            // numbers of bytes read              byte[] buffed = new byte[1024];             //open file requested download              filestream fin = new filestream(clientform.sharedfolderpath + "\\" + namefile, filemode.open, fileaccess.read);             //one way of transfer on sockets using networkstream              //it provides useful ways transfer data              networkstream nfs = client.getstream();              //lock thread here             lock (this)             {                 while (rdby < total && nfs.canwrite)                 {                     //read file (len contains number of bytes read)                     len = fin.read(buffed, 0, buffed.length);                     //wait downloader..                     thread.sleep(1);                     //write bytes on socket                     nfs.write(buffed, 0, len);                     //increase bytes read counter                     rdby = rdby + len;                 }                 //display message showing sucessful file transfer                 fin.close();             }         }         catch (exception ed)         {             messagebox.show(ed.message);         }     } 

can me please?

  1. i need identify when file compressed , if not, need compress it.

what best way that?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -