Skip to content
Ken Galle edited this page May 5, 2016 · 1 revision

Notes for Pipeline:
A lot of logic is stored in the way the program is called, so I'm sharing my notes on that.

# Run this:./pipeline node0 ipc:///tmp/pipeline.ipc 
# and this:node0=$!
# at the same time - and in the background.
# The node0 variable gets the process id of the pipeline run.
# If both of those succeed, then sleep 1 is run.
# Note that "node0" and "node1" that come after "./pipeline" are 
#   just text names and not the same as the node0 variable.
# The node0() function is a while(1) loop, so save off its
# process-id ("node0=$!") so that is can later be killed off with
# "kill $node0".  This is the receiving node, so it waits to 
# receive stuff indefinitely.  Node1 sends stuff, so it sends it
# and then exits.
./pipeline node0 ipc:///tmp/pipeline.ipc & node0=$! && sleep 1
./pipeline node1 ipc:///tmp/pipeline.ipc "Hello, World!"
./pipeline node1 ipc:///tmp/pipeline.ipc "Goodbye."
kill $node0

The url "ipc:///tmp/pipeline.ipc" is specific to the nn_bind() function (http://nanomsg.org/v0.1/nn_bind.3.html) and it creates a socket file at /tmp/pipeline.ipc (at least on Linux). This file persists after the run is complete, but is cleared off when the machine is restarted because it is in /tmp.

Clone this wiki locally