This is a simple chat application that demonstrates the use of TAO. It consists of client and server programs. The server broadcasts messages from one client to all the clients registered with it. The client(s) register with a running server. It has a very simple user interface that accepts strings from the user and sends them across to the server. The client code also demonstrates the use of the ACE_Event_Handlerclass to accept user input events.
To keep this example simple, the server advertises its IOR in the following manner; the server program writes its server object's IOR to an ior_file. Later on, the client reads this IOR from the specified ior_file and uses the 'string_to_object' method to obtain a reference to the server object.
For this mechanism to work, the file must be readable and writable. If it doesn't exist, a new file is created by the server. Moreover, the file path must be accessible to both the client and server.
If the client and server are on different machine, then there must be a shared directory accessible by both. On UNIX systems this is typically done via the NFS mount command. On Windows, the 'explorer' application provides an option to share drives.
In general if no such file sharing option is available, then using the the Naming Service mechanism is the only alternative, as described by the -n option below. There are other command line options available for the server and client which are also explained below.
server [-o <IOR_file_name>]
Options
On successfull initialization, the server displays a message that it is running and waits for clients to register with it. If the -o <ior_output_file> option is not specified on the command line then the the server will write the IOR of the server CORBA object to a default file - "chat.ior".
client [-n <your_nick_name> -f <IOR_file_name> ]
Options
The nickname specified by the user is displayed by the chat server to all the clients. To quit the chat, type "quit".
If the [-f <IOR_file_name>] option is not specified on the command line then the client will attempt to read the IOR of the server CORBA object from the default file - "chat.ior".