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.