[omniORB] Getting client IP address in server

Brecht Vermeulen brecht.vermeulen@rug.ac.be
Wed, 13 Feb 2002 17:34:41 +0100


Hi,

we're in the process of creating a CORBA Naming Server which supports
load balancing and is based on the omniNames Naming Server. 

For one of the possible algorithms for load balancing we would like to
return an object reference based on the client IP address.

Now is of course my question if it's possible to get the IP address of
the client in the server and if so, what is the best way ?

There was a post of Sai-Lai in March 2001, and I would like to know if
this is still the way to go with omniORB4, or if interceptors or
something else could be more easy/interesting for this ?

http://www.uk.research.att.com/omniORB/archives/2001-03/0197.html

>>>>> Duncan Grisby writes: 

> On Friday 23 March, SaE wrote: 
>> how to find out client IP on server side ? 

> You can't. The CORBA standard doesn't specify a way to do it, and 
> omniORB doesn't have a proprietary extension for it. 

If you just want to decide, based on the client IP address, whether to 
accept or decline a connection request from the client, you can use the 
gatekeeper interface inside omniORB. See the user guide for details. 

On the otherhand, if your design requires you to determine the client IP 
address inside the implementation of an operation, you can use the 
gatekeeper interface to extract the client IP address from the socket 
(using getpeername()), put the info into a per-thread storage and
extract 
the value in your implementation. You either use the pthread "key" or
the 
equivalent in Win32 thread API to access the per-thread storage. With 
Win32, you must clean up the storage after use or there will be a memory 
leak. 

Regards, 

Sai-Lai 

thanks for any hint,
best regards,
Brecht Vermeulen

Department of Information Technology
Ghent University