1
我有一個C++客戶端通過omniOrb將Corba消息發佈到c#服務器。我已經在服務器端註冊了一個帶有Orb的PortableInterceptor,並且可以攔截消息。 在調試中,我在攔截器中獲得ServerRequestInfo消息,並且在調試監視窗口中可以看到帶有客戶端IP的RemoteEndPort。然而,很多這些類都有私人成員,我無法在代碼中訪問這些成員。如何從服務器獲取我的Corba客戶端的IP地址
我該怎麼做?
這裏是我的代碼
// 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");
}
.
.
}
如果您確實需要知道誰在發送請求,請嘗試攔截器。 – Makah 2013-05-03 14:23:39