【发布时间】: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");
}
.
.
}
【问题讨论】:
-
如果你真的想知道是谁在发送请求,试试拦截器。