C# 如何从服务器获取Corba客户端的IP地址 < >我有一个C++客户端通过OMiNoRB发布一个C语言服务器的CORBA消息。我已经在服务器端向Orb注册了一个PortableInterceptor,可以拦截消息。 在debug中,我在intercept中得到一条ServerRequestInfo消息,在debug-watch窗口中,我可以看到客户机的IP一直到RemoteEndPort。然而,这些类中有很多都有我在代码中无法访问的私有成员

C# 如何从服务器获取Corba客户端的IP地址 < >我有一个C++客户端通过OMiNoRB发布一个C语言服务器的CORBA消息。我已经在服务器端向Orb注册了一个PortableInterceptor,可以拦截消息。 在debug中,我在intercept中得到一条ServerRequestInfo消息,在debug-watch窗口中,我可以看到客户机的IP一直到RemoteEndPort。然而,这些类中有很多都有我在代码中无法访问的私有成员,c#,corba,iiop,C#,Corba,Iiop,我该怎么做 这是我的密码 // register the OrbInitialiser here in some code omg.org.CORBA.OrbServices orb = omg.org.CORBA.OrbServices.GetSingleton(); orb.RegisterPortableInterceptorInitalizer( new LT.Quantifi.BrokerOrbInitialiser()); orb.CompleteInterceptorRegist

我该怎么做

这是我的密码

// 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");
    }
.
.
}

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

如果您确实需要知道谁在发送请求,请尝试拦截器。