A simple file transfer server and client application for CCNx built on the Portal API.
CCNx Simple File Transfer main page
CCNx.org
This is the CCNx Simple File Transfer tutorial (formerly CCNx Tutorial Demo), a very simple tutorial demonstrating an application using the CCNx Portal API, the CCN Software Stack and the CCN Metis Forwarder. It includes a set of programs, with source code, to serve files and retrieve files. Files are transferred using a basic 'chunked' protocol.
The point of the tutorial is to demonstrate how to use the CCNx Portal API. With this as an example, you should be able to understand how you could apply the API to your own application.
After building, the demo consists of 2 programs:
ccnxSimpleFileTransfer_Server
: Serves files out of a directory.ccnxSimpleFileTransfer_Client
: Lists and retrieves files from the server.
The CCNx-Tutorial-Demo needs the Distillery CCNx distribution installed on the system. Please install the CCNx Distillery by downloading it from GitHub, here, and building it according to the instructions there.
To run the tutorial programs you will need a CCN forwarder (metis or athena) running. We'll use metis for this example, but either would work.
Start by running 'metis_daemon --capacity 0', then the ccnxSimpleFileTransfer_Server
(to serve files)
and then the ccnxSimpleFileTransfer_Client
to access the server. It is recommended that you run
the metis_daemon
, ccnxSimpleFileTransfer_Server
and ccnxSimpleFileTransfer_Client
in different windows.
It is also recommended you run metis_daemon with the '--capacity 0' option to disable the cache on the forwarder. This makes experimenting more predictable, as all Interests will make it through to the ccnxSimpleFileTransfer_Server.
Compiling the tutorial:
-
Set the CCNX_HOME environment variable to the location of your Distillery build. In zsh, for example, it might look like this:
export CCNX_HOME=/path/to/CCNx_Distillery/usr
-
If you ran 'make all' when you built the CCNx_Distillery distribution, you should already have the binaries in your $CCNX_HOME/bin directory.
If they are not there, you can run 'make ccnxSimpleFileTransfer' from the CCNx_Distillery directory.
-
At this point, the compiled binaries for
ccnxSimpleFileTransfer_Client
and theccnxSimpleFileTransfer_Server
should be built and exist in $CCNX_HOME/bin -
Start a forwarder. Do ONE of the following:
4a. Start the CCNx forwarder,
metis_daemon
:$CCNX_HOME/bin/metis_daemon --capacity 0 &
4b. Start the CCNx forwarder,
athena
:$CCNX_HOME/bin/athena -s 0 &
-
Run the
ccnxSimpleFileTransfer_Server
: Start theccnxSimpleFileTransfer_Server
, giving it a directory path as an argument.$CCNX_HOME/bin/ccnxSimpleFileTransfer_Server /path/to/a/directory/with/files/to/serve
-
Run the
ccnxSimpleFileTransfer_Client
to retrieve the list of files available from theccnxSimpleFileTransfer_Server
:
$CCNX_HOME/bin/ccnxSimpleFileTransfer_Client list
# Will return a list of available files
Or, use the ccnxSimpleFileTransfer_Client
to fetch a file from the ccnxSimpleFileTransfer_Server
:
$CCNX_HOME/bin/ccnxSimpleFileTransfer_Client fetch <filename>
# Will fetch a file using the chunked protocol
NOTE: Do not run the ccnxSimpleFileTransfer_Client
in the same directory from which you are serving files as it will overwrite the source file and things will break.
-
The
ccnxSimpleFileTransfer_Client
andccnxSimpleFileTransfer_Server
automatically create keystore files in their working directory. -
You can experiment with different chunk sizes by changing the value of
ccnxSimpleFileTransferCommon_DefaultChunkSize
, which is defined inccnxSimpleFileTransfer_Common.c
.
If you have any problems with the system, please discuss them on the developer
mailing list: [email protected]
. If the problem is not resolved via mailing list
discussion, you can file tickets in the issue tracker.
For any questions please use the CCNx mailing list. [email protected]
This software is licensed under the PARC Software License. See LICENSE File.