[omniORB] Message source

baileyk@schneider.com baileyk@schneider.com
Fri, 19 Apr 2002 10:26:51 -0500



>If I have a servant with multiple client machines connected to the
servant, what is the correct way of telling >which client made a
>function call?

If you want to know the _machine_ which made the function call, the
previous answers are the way to go.  On the other hand, if you want to know
the _client_ which made the call, I would offer a different solution.
Multiple clients may be on the same machine, or in some cases a client may
migrate from one machine to another.  In these cases, the IOR the client is
using to connect to the server should carry the identifying information.  I
suggest using a factory which generates IORs using a POA holding a default
servant.  The factory would generate an identifier for each client and
embed it in the IOR's object ID.  The default servant could then extract
the object ID during the up-calls and be able to identify the client.  The
factory's create() method may accept any information that should be part of
the object ID (like user ID).  With this approach, you are still 100%
portable and you only have one servant to keep track of as before.  If you
need to keep per-client state, the default servant can keep it in a map or
even a database table using the object ID as a key.  You might need to
expire the client state if it isn't used (LRU or idle time limits).

I would try to avoid tracking client IP if possible.  It isn't part of the
standard CORBA model.  You can use the approach above and have the client
pass in a machine name.  That puts the responsibility for looking up the
name on the clients, though.  You would need to trust your clients.


Kendall