YARP Port Namespaces
From Wiki for RobotCub and Friends
Why you should use just one yarp name server
Normally it is a good idea to run just one yarp name server on a given local network. The name server keeps track of resources (such as socket port numbers) available on different machines, and if two name servers are in use, there can be conflicts as each server assigns resources without being aware of the other.
If you really really want more than one name server
If you are aware of the potential for resource conflict, and take steps to avoid it, it is sometimes useful to run multiple name servers. This page describes how. It requires an experimental feature of YARP, beginning at version 2.1.6. You can check if you have this feature by typing "yarp namespace". If you are told "Could not find command", then you'll need to upgrade.
Type:
yarp namespace
It will report something like:
No namespace specified, using default YARP namespace: /root
This means that we expect to use a server called "/root". This is the default. Let's assume there's already a name server running somewhere on your local network. It will be called "/root". Now suppose we want to avoid using that name server, and use one on our own machine temporarily. Pick a name you like, for example "/my/root" and type:
yarp namespace /my/root
This will report something like:
Setting namespace in: /home/paulfitz/.yarp/conf/yarp_namespace.conf Remove this file to revert to the default namespace (/root) YARP namespace: /my/root
All further queries of the form:
yarp namespace
report:
YARP namespace: /my/root
Typing:
yarp where
should fail right now, since the "/root" name server will be ignored, and there is no name server with the name "/my/root" available. Let's rectify that. On your machine, type:
yarp server
This will start up a server with the name "/my/root". Now "yarp where" should start working, and if you type:
yarp check
it should work, and you should see ports being registered on your personal name server.
To switch back to using the main name server, type:
yarp namespace /root
Be careful switching from one to the other, since names registered in one namespace are not registered in the other.
If you want to simultaneously use both name servers, you'll need to be very careful. At a minimum, you'll want to start up your personal name server to allocate socket port numbers in a different range to the default (10000-):
yarp server 20000

