A simple file transfer server and client application for CCNx built on the Portal API.
CCNx Tutorial main page
CCNx.org
This is the CCN 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:
tutorial_Server
: Serves files out of a directory.tutorial_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 metis by running 'metis_daemon --capacity 0', then the tutorial_Server
(to serve files)
and then the tutorial_Client
to access the server. It is recommended that you run
the metis_daemon
, tutorial_Server
and tutorial_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 tutorial_Server.
Compiling the tutorial:
-
Go into the tutorial directory created when you cloned or unpacked the tutorial:
$ cd ccnx-tutorial-<version>
-
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
-
Compile the tutorial.
$ make
If 'make' has trouble finding libraries, such as libevent, you can also export LIBEVENT_HOME, like so:
-
export LIBEVENT_HOME=<value of DISTILLERY_EXTERN_DIR from 'make info' in your Distillery directory>
-
e.g.
export LIBEVENT_HOME=/usr/local/ccnx/dependencies/build
-
-
At this point, the compiled binaries for
tutorial_Client
and thetutorial_Server
should be built. -
Optionally install the tutorial binaries to the specified prefix in the configure step (eg
$HOME/ccnx
). You will then be able to find the binaries in the bin directory (eg$HOME/ccnx/bin
)make install
-
Start the CCNx forwarder,
metis_daemon
:
$HOME/ccnx/bin/metis_daemon --capacity 0&
-
Running the tutorial_Server and tutorial_Client: Start the tutorial_Server, giving it a directory path as an argument.
$HOME/ccnx/bin/tutorial_Server /path/to/a/directory/with/files/to/serve
-
In another window, run the tutorial_Client to retrieve the list of files available from the tutorial_Server. Do not run the tutorial_Client from the same directory you are serving files from.
$HOME/ccnx/bin/tutorial_Client list
Will return a list of files from the tutorial_Server
Or, use the tutorial_Client to fetch a file from the tutorial_Server.$HOME/ccnx/bin/tutorial_Client fetch <filename>
Will fetch the specified file
-
The
tutorial_Client
andtutorial_Server
automatically create keystore files in their working directory. -
If you run
tutorial_Client
on the same directory that thetutorial_Server
is serving files from you will run into problems when you try to fetch a file. -
tutorial_Client
and tutorial_Server requiremetis_daemon
to be running. -
The makefiles automatically set an LD_RUN_PATH variable so that you don't have to set it. They use the paths found by the configure script as default vaules. If a different value is found in the environment then that will be used. If you have no idea what this is about you can ignore this.
If you have any problems with the system, please discuss them on the developer
mailing list: ccnx@ccnx.org
. 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. ccnx@ccnx.org
This software is licensed under the PARC Software License. See LICENSE File.