SpeakToPh Application
December, 1991

The SpeakToPh application provides an example of how a programmer can use the Ph Speaker/Listener support.  Perhaps the best way to understand SpeakToPh is to run it and then review the SpeakToPh source code.  Be sure Ph has been installed in your ~/Apps or /LocalApps directory before you run SpeakToPh.

Do not install SpeakToPh as an application.  It is intended for demonstration only.  

 Ph Listener Methods

The Ph Listener methods are documented below.  The getServers and showServers methods are probably the most useful methods.

- (int) hide;

This method will hide Ph.

- (int) unhide;

This method will show Ph.  This is also the easiest way to launch Ph if it is not currently running.

- (int) addServer:(char *)aServer site:(char *)aSite ok:(int *)flag;

This method will add the server/site to Ph's CSO Nameserver list.  Flag will be set to NO if Ph is in the process of fetching its Nameserver list from the default Nameserver.  Your code should account for this possibility by checking the flag and sleeping a second or two before repeating the attempt.  If the server already exists in the Ph Nameserver list, your request will be ignored.

- (int) getServers:(char **)serverNames sites:(char **)siteNames ok:(int *)flag;

This method will return Ph's CSO Nameservers/sites.  Flag will be set to NO if Ph is in the process of fetching its Nameserver list from the default Nameserver.  Your code should account for this possibility by checking the flag and sleeping a second or two before repeating the attempt. 

- (int) queryServer:(char *)aServer site:(char *)aSite command:(char *)aCommand
		 ok:(int *)flag;

This method will send the query command to the specified CSO Nameserver.  The command must be a tab-separated list of keyword=value items (eg., name=Rex Pruess\tdepartment=Weeg).  If aServer exists in the Ph CSO Nameserver list, Ph ignores the aSite parameter.  If aServer does not exist, Ph adds aServer/aSite into its Nameserver list before making the query.

- (int) showServer:(char *)aServer site:(char *)aSite ok:(int *)flag;

This method will open a query window with the specified CSO Nameserver.  This is a simplified form of the queryServer method.  If aServer exists in the Ph CSO Nameserver list, Ph ignores the aSite parameter.  If aServer does not exist, Ph adds aServer/aSite into its Nameserver list before opening the query window.

 Author

Ph and SpeakToPh were written by Rex Pruess, Weeg Computing Center, The University of Iowa.  He is also the author of Remotes and contributed the RPC code for NLoad.