【问题标题】:How do I get the IP address of my Corba client from the sever如何从服务器获取我的 Corba 客户端的 IP 地址
【发布时间】:2013-04-23 17:08:30
【问题描述】:

我有一个 c++ 客户端通过omniOrb 将Corba 消息发布到c# 服务器。我已经在服务器端注册了一个 PortableInterceptor 到 Orb 并且可以拦截消息。 在调试中,我在拦截中收到一条 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");
    }
.
.
}

【问题讨论】:

  • 如果你真的想知道是谁在发送请求,试试拦截器。

标签: c# corba iiop


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-13
    • 1970-01-01
    • 1970-01-01
    • 2012-12-01
    • 2013-12-18
    相关资源
    最近更新 更多