Accelerating transfers from a .NET environment

by , June 3, 2013

Among our many APIs, FileCatalyst offers a way to integrate into a .NET platform using the FileCatalyst .NET DLL. The DLL can be used in C# applications as well as VB and C++.

The DLL is a wrapper around our command line interface (CLI) tool. We wrote code to generate command line arguments as well as parse the output of the transfers. Since the CLI takes care of all transfers, there is no additional overhead to the transfer if you use the DLL.

To get started with the DLL, contact a sales person for download access.

Once the zip archive is obtained, extract it and place the FileCatalystAPI.dll file in the bin folder of your application. Users will also need to copy the FileCatalystCL.jar file to the same location as the DLL. The archive also includes a help file. The help file gives access to all the exposed Properties as well as other Classes users may wish to use.

Below is a sample file to help users get started with uploading a file using .NET with acceleration. Simply replace the values in with your server settings and then run the project.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FileCatalystAPI;
using System.Threading;

namespace FileCatalystAPITest
{
  class SampleUpload
   {
     static void Main(string[] args)
    {
       FCClient fc = new FCClient("", );
       fc.UserName = "";
       fc.Password = "";
       fc.LocalWorkingDirectory = "";
       fc.FileToTransfer = "C:\\Temp\\bigfile0.txt";
       //fc.UseIncremental = true;
       //fc.IncrementalMode = TransferMode.TRANSFER_FILE_DELTAS;
       fc.LogLocation = "C:\\fclogs";
       fc.TargetRate = 1000000;
       fc.UseCongestionControl = true;
       fc.Mode = TransferMode.UDP;
       fc.AutoZip = false;
       fc.BlockSize = 4096000;
       fc.NumThreads = 3;
       fc.NumberSenderSockets = 1;
      fc.CongestionControlAggression = 2;
fc.CongestionControlStrategy = 1;
       //fc.ZipFileSizeLimit = 100000;
       //fc.ServletLocation = "http://localhost:12480/servlet/ftpservlet";
       fc.WindowStyle = 1;
       fc.CreateNoWindow = true;
       fc.OutputToConsole = true;
       fc.JavaArguments = "-Xmx1g -Xms512m";

       TransferHook Transfer = new TransferHook();
       try
       {
         DateTime startTime = DateTime.Now;
         fc.Upload(Transfer); //starts upload it in its own thread

        while (!Transfer.Cancelled && !Transfer.TransferCancelled && !Transfer.TransferComplete && !Transfer.TransferError)
         {

           Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
           {
             e.Cancel = true;
             Transfer.Cancelled = true;
             Transfer.TransferCancelled = true;
           };

           //Un-comment if you want stats printed in the console.
           /*Console.WriteLine(Transfer.StatusMessage + " " + Transfer.StatusCode + " " + Transfer.CurrentFilename + " " +
             (Transfer.BytesSoFarCurrentFile + Transfer.SizeTransferredAlreadyCurrentFile + Transfer.SizeTransferredAlreadyCurrentFile) + " " +
             (Transfer.BytesSoFarAllFiles + Transfer.SizeTransferredAlreadyAllFiles) + " " +
             Transfer.CurrentPercent + " " +
             Transfer.Percent + " " +
             Transfer.RateInKBperSecond + " " +
             Transfer.OverallTransferTime + " " +
             Transfer.OverallTimeRemainingMillis + " " +
             Transfer.SizeAllFiles);*/
          System.Threading.Thread.Sleep(490);
        }
        TimeSpan timeSpan = new TimeSpan(DateTime.Now.Ticks - startTime.Ticks);
         System.Windows.Forms.MessageBox.Show("Upload took: " + timeSpan.ToString());
       }
       catch (Exception e)
       {
         System.Windows.Forms.MessageBox.Show(e.Message, "Error in parameter", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
       }
     }
   }
}
Revision List

#1 on 2013-Jun-03 Mon  06:25+-14400

#2 on 2013-Jun-03 Mon  06:23+-14400

#3 on 2013-Jun-03 Mon  06:28+-14400

#4 on 2013-Jun-03 Mon  06:27+-14400

#5 on 2013-Jun-03 Mon  06:29+-14400

#6 on 2013-Jun-03 Mon  06:20+-14400

#7 on 2013-Jun-03 Mon  06:15+-14400

No Comments Yet

Be the first to respond!

Sorry, comments for this entry are closed at this time.