Overview

FASP Stream SDK

The Aspera FASP Stream API was designed to allow Aspera transfer technology to be integrated into application while providing a familiar paradigm to developers. To learn more about the FASPStream SDK, view the Intro to FASPStream video. The FASP Stream API can be used to send byte-stream data using the FASP protocol and allows third parties to integrate directly to allow for direct ingest and deployment to any Aspera Server as well as Point-to-Point environments using a simple File IO interface.  

FASP Stream can be approached in multiple ways.  You can use FASP Stream for:

  • Stream to Stream - which lets you feed data from an application to another application using Standard IO and the FASP Protocol, this allows a quick way for your application to read in data and send it to another application that can render it or utilize it as the data is received.
  • File to Stream - which lets you send a file from an Aspera Server to an application that can read the file as a stream of data and interpret it or use it without waiting for the entire file to be delivered.
  • Stream to File - which lets you stream data from your application as it is being generated to an Aspera Server that can save it to a file on the server once it receives the end of the stream.

 


Uses

File to Stream & Stream to File

When using FASP Stream for transferring Files to Stream or transferring a Stream to a File you have the ability to provide a byte-stream write interface into an Aspera Server or a byte-stream read interface out of an Aspera Server.  By using this approach you can easily receive data on an Aspera Server as it is being generating by your application or have your application receive and process a stream being sent from a file on an Aspera Server.

Prerequisites

In order to use FASP Stream's File to Stream or Stream to File approach you need to ensure that the ascp binary on the machine that is sending the stream is at least version 3.6.  The ascp binary on the other machine needs to be at least version 3.5.2. You can check what version of ascp you have by running 'ascp -A' on the machine in question.

Stream to FileFASPStream to file

The FASP Stream SDK can be used to transfer in-memory data to an Aspera Server that can save it as a file.  Custom applications integrating the FASP Stream SDK may create an output stream using FASP and write data to the pipe in order to transfer the bytes to the Aspera Server.  The example below shows the normal steps and includes comments explaining the use of the SDK in the C# project.

Java

The general structure of a FASPStream SDK Java application in stream to file mode is the following:

  1. Create an instance of an output stream using the faspstream.

    public static FaspOutputStreamSAE fos = new FaspOutputStreamSAE();
  2. Set the transfer authentication information

    fos.setUsername("asperaweb");fos.setPassword("demoaspera");
  3. Set transfer parameters (eg. target rate, destination file name).

    fos.setTargetRate(10000);fos.setDestinationFilename(f.getName());fos.setDestinationDirectory("/Upload");
  4. Initiate the session to the remote Aspera Server.

    fos.connect(host, f.length());
  5. Loop over the input data and write to the faspstream output stream to transfer.

    fos.write(data, 0, count);
  6. When finished, close the output stream.

    in.close();fos.close();

Full Example

 

C#

The general structure of a FASPStream SDK C# application in stream to file mode is as follows.

  1. Create an instance of an output stream using the faspstream.

    FaspOutputStream fos = new FaspOutputStream();
  2. Set the transfer authentication information.

    fos.setUsername("xfer");
  3. Set transfer parameters (for example, target rate, destination file name).

    fos.setRateTarget(3000);fos.setDestinationFilePath("/demo/big_trend.mov");
  4. Initiate the session to the remote Aspera Server.

    fos.connect(host);
  5. Loop over the input data and write to the faspstream output stream to transfer.

    fos.write(data, 0, count);
  6. When finished, close the output stream.

    fos.close();

Full Example

 

File to StreamFile to FASP Stream

The FASP Stream SDK can be used to send a byte-stream of data from a file as it is being read by an Aspera Server, this allows the receiving application to access the data in memory as it is being received rather than waiting on the complete file.  The example below shows the normal steps and includes comments explaining the use of the SDK in the C# project.

Java

The general structure of a FASPStream Java application in file to stream mode is as follows:

  1. Create an instance of an input stream using the faspstream.

    public static FaspInputStreamSAE fis = new FaspInputStreamSAE();
  2. Set the transfer authentication information.

    fis.setUsername("asperaweb");fis.setPassword("demoaspera");
  3. Set transfer parameters (for example, target rate, source file name).

    fis.setSourceFilePath(sourceFilePath);
  4. Initiate the session to the remote Aspera Server.

    fis.connect(host);
  5. Loop over the input stream to receive data.

    destFileStream.write(data, 0, count);
  6. When finished, close the input stream.

    fis.close();
    

Full Example

 

C#

The general structure of a FASPStream C# application in file to stream mode is as follows:

  1. Create an instance of an input stream using the faspstream.

    FaspInputStream fis = new FaspInputStream();
  2. Set the transfer authentication information.

    fis.setUsername("xfer");
  3. Set transfer parameters (for example, target rate, source file name).

    fis.setSourceFilePath(sourceFilePath);
  4. Initiate the session to the remote Aspera Server.

    fis.connect(host);
  5. Loop over the input stream to receive data.

    fis.read(data, 0, length);
  6. When finished, close the input stream.

    fis.close();

Full Example

 

 


Stream to Stream

FASP Stream uses the Stream to Stream approach to provide a byte-stream write interface that allows you to use a standard File IO interface to read and write data using the FASP protocol.  The FASP Stream SDK allows you to enable in-memory to in-memory data transfer.  This allows the sender to be able to send byte-stream data as it is being captured or created to a receiver who can consume the stream of data and still give you full control over the pre/post processing within your implementation.  In order to implement this, you need to develop a custom FASP Stream Receiver and a custom FASP Stream Sender.  It should be noted that the receiver must always start first.  As it will wait to accept a connection from the sender.  Once the connection is made the data byte stream can be transmitted.  The receiver will accept a sender connection over a TCP port, and will negotiate a UDP port to use for the data transfer.

Prerequisites

In order to use FASP Stream's Stream to Stream approach you need to ensure that the FASP Stream binary, you can download the binary with the SDK in the Downloads section or if you are using Server 3.6 or higher it is included with the distribution.

OverviewFASPStream Point to Point

The Faspstream SDK can be used to enable memory to memory data transfers via the FASP protocol.

FaspStream Clients and Servers are able to send or receive byte-stream data as it is being captured or created. Developers have full control over the pre and post-processing from within both the Client and Server endpoints. This approach requires a developer to implement:

  • A custom FaspStream Server application.
  • A custom FaspStream Client application.

The Server must be started first, as it will wait to accept a connection from the sender peer. Once they are connected, the data byte stream can be transferred. The Receiver accepts a Client connection on a TCP port, and then negotiates UDP port to use during data transfer with the sender.

Note about Java

The newest version of the FaspStream API in Java includes support for both sending and receiving stream data over FASP. With this version the paradigm has shifted and the concept of a server and client has been introduced as opposed to the receiver and sender model. Now a client always connects to a server and can either push or pull bytes.

The best way to get acquainted with this new setup is to use the examples that are included with the download. The example GenericServerExample and GenericClientExample are included and can easily be ran using the included redistributable binaries. You will need to have a valid server-type license that will overwrite the 'client' aspera-license file that is already there.

To run the examples you can copy the files below or use the copy that is included in the download (the download includes a version already compiled as a jar file that you can run, if you copy the code you will need to compile it as well). To run the example on a Linux type machine cd to the example directory and start the server with the following command:

java -cp lib/faspstream-examples-1.0.0.jar:../lib/faspstream-1.0.0.jar:conf samples.p2p.GenericServerExample

Next you will need to start the Client using the following command

java -cp lib/faspstream-examples-1.0.0.jar:../lib/faspstream-1.0.0.jar:conf samples.p2p.GenericClientExample

Implementing a Receiver

To implement the Receiver you can use the example below, a C++ and Java version is available and is commented below to explain each step.

Java Receiver Example

 

C++ Receiver Example

 

C# Receiver Example

 

Implementing a Sender

To implement the Sender you can use the example below, a C++ and Java version is available and is commented below to explain each step.

Java Sender Example

 

C++ Sender Example

 

C# Sender Example

 

 


Downloads

Download

To download the FASPStream SDK, please choose a language and version from the list below.

.NET

The "FASPStream VS 2013 .NET 4 Distribution" is a jumpstart project for FASPStream including a VS 2013 project utilizing the .NET 4 Framework.

The "FASPStream v3.7.3" includes nuget packages for the SDK and samples

C/C++

Java

 


Video player

Video

×