2013-04-23 109 views
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"); 
    } 
. 
. 
} 
+0

如果您確實需要知道誰在發送請求,請嘗試攔截器。 – Makah 2013-05-03 14:23:39

回答

0

還有就是可以訪問的CORBA這些信息的標準方式。某些實現有自定義的方式來獲取某些信息,例如TAO有一個您可以訪問的傳輸當前對象。在使用IIOP接收到呼叫的時刻,您可以將其縮小爲IIOP傳送當前電流而不是給您提供該信息。看起來您需要C#ORB的擴展才能擁有類似的擴展

相關問題