[omniORB] Using interceptor to determine client host ip:port
JHJE (Jan Holst Jensen)
jhje at novonordisk.com
Fri Jun 27 11:36:39 BST 2003
> Date: Tue, 24 Jun 2003 14:23:44 -0700
> From: "Burton, Craig" <CBurton at verisign.com>
> Subject: [omniORB] Using interceptor to determine client host ip:port
>
> Is it possible to use the server interceptor function
> 'serverReceiveRequest' to determine the initiating client's
> host ip and port number? If so, does anyone have an example?
I have one. Sorry, it is in Pascal, but translates very easily to C++:
procedure TMyInterceptor.receive_request(const ri: IServerRequestInfo);
var
pr: IPrincipal;
a: IAny;
addr: string;
begin
pr := TPrincipalCurrent._narrow(
Orb.resolve_initial_reference('PrincipalCurrent')
).get_principal;
a := pr.get_property('peer-address');
a.get_string(addr);
writeln('Got request from "', addr, '".');
end;
On my machine it outputs something like 'Got request from
"inet:10.9.18.124:2239".'.
> Is there another way to determine client host ip and port
> (that doesn't use interceptors)?
I was just about to reply "Don't know", but then tried the above interceptor
code inside a normal servant method. No problem - so I guess the answer is
sort of "Yes": I don't know another method, but you don't have to use
interceptors.
Cheers
-- Jan Holst Jensen, Novo Nordisk A/S, Denmark
More information about the omniORB-list
mailing list