title: File transfer in FTP
body: <p>I want to transfer files using ftp in a simple and effective manner. For example, if we want to send a file means we just put the entire file with commands, but if it is a huge file and the network strength is low means automatically the transferspeed will be reduced.
  What will be the effective method to transfer a huge file even the network strength is low?</p>
  
  <p>Below is the piece of code where i get some error,please have a look at it.i employed threading here:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      ArrayList AscendingList = new ArrayList();
      ListViewItem Litem = null;
      Thread MyThread = null;
      ThreadStart Starter = null;
  
      public Form1()
      {
          InitializeComponent();
      }
  
      private void btn_split_Click(object sender, EventArgs e)
      {
          foreach (ListViewItem litem in listView1.Items)
          {
              Starter = delegate { SplitFile(litem.Text,litem.SubItems[1].Text,int.Parse(litem.SubItems[2].Text)); };
              MyThread = new Thread(Starter);
              MyThread.IsBackground = true;
              MyThread.Start();
          }
      }
      public void SplitFile(string inputFile, string outputPrefix, int chunkSize)
      {
          int pointr = 0;
          byte[] buffer = new byte[chunkSize];
  
          using (FileStream fs = new FileStream(inputFile, FileMode.Open, FileAccess.Read, FileShare.None))
          {
              int index = 0;
              pointr = fs.Read(buffer, 0, buffer.Length);
              while (pointr != 0)
              {
                  using (FileStream fso = new FileStream(outputPrefix + "\\" + index + ".log", FileMode.Create))
                  {
                      AscendingList.Add(fso.Name);
                      fso.Write(buffer, 0, pointr);
                      pointr = fs.Read(buffer, 0, buffer.Length);
                  }
                  index++;
              }
          }
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          Litem = new ListViewItem();
          Litem.Text = "E:\\butterfly.mpg";
          Litem.SubItems.Add("H:\\karthik");
          Litem.SubItems.Add("102400");
          listView1.Items.Add(Litem);
      }
  
      private void button2_Click(object sender, EventArgs e)
      {
          Litem = new ListViewItem();
          Litem.Text = "E:\\karthik.mpeg";
          Litem.SubItems.Add("H:\\karthik\\karthik");
          Litem.SubItems.Add("102400");
          listView1.Items.Add(Litem);
      }
  }
  </code></pre>