This example assumes a Windows C++ development environment using Microsoft Visual Studio.
In addition to Visual Studio C++, you'll need 2 files:
Make sure you download the correct 32-bit or 64-bit files, depending on what you'll be building. In this example, a 64-bit application will be built.
Install Boost and the FileCatalyst C++ API/SDK. Note the installation directory of FC++, which should default to "C:\Program Files\FCpp\"
.
A number of links are installed in the "Start"
menu, including a link to the entire FC++ API/SDK documentation.
The location into which FC++ was installed will contain several important directories for C++ development. This includes all of the header files in include
and the libraries against which to link in lib
.
Unless this was changed during the installation, on Windows the default installation directory should be "C:\Program Files\FCpp\"
.
Create a new Visual Studio C++ project. For this example, a simple console application will be built.
Several project properties need to be modified to use FC++.
In the Visual Studio Solution Explorer, right-mouse-click on the the application name to edit the properties
Add the Boost and FC++ include directories so Visual Studio can find the necessary header files.
Similarly, add the necessary directory names so Visual Studio can find the necessary libraries.
FC++ uses OpenSSL for encryption and decryption of streams.
Edit the linker's "Additional Dependencies"
and add the two OpenSSL libraries.
Here is an example application that will perform a simple call into the FC++ library. This will obtain two version numbers. The first is the base FileCatalyst version string, the second is the FC++ library build string.
Uploading and downloading files doesn't take much code with FC++:
At the simplest, a transfer would typically take 3 lines of code:
Similarly, uploading is as easy:
There are 2 central C++ classes in FC++:
Many options can be set to alter the behaviour of file transfers. All of the options are described in the installed FC++ HTML documentation.
For example:
To see the full list of options that may be set, see the documentation for the C++ class fc::Options as well as suggested Recommendations.
Multiple files can ben queued for upload or download. Entire directories can also be easily queued, as well as recursive transfers.
This example shows how to setup multiple transfers, including recursive directory transfers:
For additional information, see fc::Control::prepareRecursiveDir() and fc::Control::prepareSingleFile().
Every transfer is recorded in a fc::TransferStats object.
These statistics can also be accessed while a transfer is on-going to provide realtime information such as transfer rates, dropped or duplicate packets, RTT, the number of bytes transferred, the estimated time left until completion, or to draw a completion bar.
Every field in the fc::TransferStats statistics object is documented. Note that some fields only apply to UDP-base file transfers. This is indicated in the documentation where appropriate.
The installed documentation includes several more examples of simple applications making use of FC++. A link to the example code can be found in the "Start"
menu.
Assuming a default installation, the examples are installed in "C:\Program Files\FCpp\doc\FCpp\examples\"
.
Included as part of the FC++ API/SDK is fccl
, a command-line tool that uses the FC++ API. This tool is very similar to the Java-based FileCatalyst command-line tool, with many of the same options. Using this tool, file transfers can easily be made from the command-line without having to install Java or any other dependencies on the client.
The FCCL tool and the FC++ SDK is currently available on the following platforms:
Please ask if you need FC++ on a different platform. Any system with a modern C++11 compiler and the Boost C++ libraries should be capable of using FC++.