There are two ways in which processes on different machines can communicate using the ToolTalk service.
They can connect to the same session.
They can scope to a file that is NFS mounted on the machines involved.
To connect the processes to the same session, you first need to determine
a common interest for the processes (for example, a scheme that associates
a session name with the common interest of the processes) and then you need
to determine how to propagate the session name to all of the processes. The
ToolTalk service does not provide a mechanism to distribute the session address
(other than the possible advertisement of a session id on the TT_SESSION
property of the root windows of
X servers).
To get a session name, you can use the command
ttsession -p |
which forks off a new session and prints its name to stdout; or you can the command:
ttsession -c |
which sets the environment variable $TT_SESSION
to the session id.
You then need to use some mechanism to put that session name in a place where the other processes can find it. Some examples of where you can place the session name are:
a shared file
a .plan file
a mail message
a separate RPC call of your own design
NIS
For example, one approach using a well-known file in a NFS-exported file system can be done as follows:
Start ttsession with the following command:
ttsession -p >/home/foo/sessionaddress |
Ensure that the clients use the session address from the file;
for example, wrap the clients in a shell script which reads the session address
and sets SUN_TT_SESSION
as follows:
#!/bin/csh setenv TT_SESSION `cat /home/foo/sessionaddress` exec client-program |
Alternately, the processes can use the session name in the tt_default_session_set call to connect to that session.
You could also send messages in the ttsession associated with a particular X server to advertise the newly-created ttsessions.
File scoping is when a process registers a file scope pattern. The name of that session is placed on a list in rpc.ttdbserverd that is associated with the registered file. When a file-scoped message is sent, the ToolTalk service retrieves the list of sessions for the file and forwards the message to each of the sessions on the rpc.ttdbserverd list for that file.
To scope to a file that is NFS-mounted on the machines involved requires a file system to be NFS mounted on all the systems and rpc.ttdbserverd to be run on the NFS server.