如何从服务器获取Corba客户端的IP地址

时间:2013-04-23 17:08:30

标签: c# corba iiop

我有一个c ++客户端通过omniOrb将corba消息发布到c#服务器。我在服务器端注册了Orb的PortableInterceptor,可以拦截消息。 在调试中,我在拦截中得到一条ServerRequestInfo消息,在调试监视窗口中可以看到一直到客户端IP的RemoteEndPort。然而,很多这些类都有私有成员,我无法在代码中访问它们。

我该怎么做?

这是我的代码

// register the OrbInitialiser here in some  code
omg.org.CORBA.OrbServices orb = omg.org.CORBA.OrbServices.GetSingleton();
orb.RegisterPortableInterceptorInitalizer( new LT.Quantifi.BrokerOrbInitialiser());
orb.CompleteInterceptorRegistration();

// register the Inteceptor in the OrbInitialiser here
public class BrokerOrbInitialiser : omg.org.PortableInterceptor.ORBInitializer
{
    public void post_init(ORBInitInfo info)
    {
        BrokerRequestInterceptor serverRequests = new BrokerRequestInterceptor();
        info.add_server_request_interceptor(serverRequests);
     }
}

// Inteceptor catches messages here
Public class BrokerRequestInterceptor : omg.org.PortableInterceptor.ServerRequestInterceptor
{
.
.
    public void receive_request_service_contexts(ServerRequestInfo ri)
    {
        Console.WriteLine("I catch messages here");
    }
.
.
}

1 个答案:

答案 0 :(得分:0)

在CORBA中没有标准的方法来访问该信息。某些实现确实有自定义方式来获取某些信息,例如TAO具有您可以访问的传输当前对象。在使用IIOP接收到呼叫时,您可以将其缩小到IIOP传输电流,而不是为您提供该信息。看起来你需要C#ORB的扩展名具有类似的扩展名

相关问题