summaryrefslogtreecommitdiff
path: root/trunk/TAO/examples/Simple/chat/README
blob: 5a7eeeb4764d4013db12bcea1507a6e25cf26b5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
$Id$

This is a simple chat application that uses the TAO CORBA ORB.  It
consists of a 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 it across to
the server.  The client code also demonstrates the use of the
ACE_Event_Handlerclass to accept user input events.

server:
-------

server [-o <ior_output_file>]

Options:
-------
-o    Outputs the server ior to the file specified.

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".

Passing the Server IOR to Clients:
---------------------------------

To keep this example simple, the server advertises its IOR in the
following manner - The server program writes its server object's IOR
to a 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 system's 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.  To preserve its
simplicity, this example does not provide the feature to use a Naming
Service. An example of such a use is $TAO_ROOT/examples/Event_Comm/.

client:
-------

client [-n <your_nick_name> -f <ior_input_file>]

Options:
-------
-n    The nickname that the chat user wants to use.
-f    Reads the server ior from the file

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_input_file>] 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".

VxWorks
-------
On VxWorks, it's easiest to run the client without any command
line options.  That way, its stdin can be captured:

    -> ld < server
    value = 400826292 = 0x17e41fb4
    -> spa main
    value = 0 = 0x0
    Running chat server...
    -> ld < client
    value = 399329360 = 0x17cd4850
    -> main

    using defaults. nickname = noname, filename = chat.ior

    ============= Simple Chat =================
    ========== type 'quit' to exit  ===========
    : **** noname has joined the chat ****

    hello
    : [noname] hello

    goodbye
    : [noname] goodbye

    quit
    value = 0 = 0x0

NOTE:  if you built your VxWorks executables with g++, replace "main"
with "ace_main" above.  See ACE-INSTALL.html for an explanation of why
ACE renames "main" to "ace_main" with g++ on VxWorks.