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.
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.
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.