2013-04-23 3 views
1

OmniOrb를 통해 C# 서버에 Corba 메시지를 게시하는 C++ 클라이언트가 있습니다. 서버 끝에있는 Orb에 PortableInterceptor를 등록하고 메시지를 가로 챌 수 있습니다. 디버그에서 나는 절편에서 ServerRequestInfo 메시지를 얻었고 디버그보기 창에서는 클라이언트의 IP로 RemoteEndPort까지 모든 것을 볼 수 있습니다. 그러나 이러한 클래스 중 많은 부분은 코드에서 액세스 할 수없는 개인 멤버가 있습니다.서버에서 내 CORBA 클라이언트의 IP 주소를 얻는 방법

어떻게해야합니까?

여기 CORBA 해당 정보에 접근하는 표준 방법이 없습니다 내 코드

// 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

답변

0

입니다. 일부 구현에는 사용자 정의 방법이있어 정보를 얻을 수 있습니다. 예를 들어, TAO에는 액세스 할 수있는 전송 현재 객체가 있습니다. IIOP를 사용하여 호출을 수신하는 순간 해당 정보를 제공하는 것보다 IIOP 전송 전류를 좁힐 수 있습니다. 비슷한 확장명을 가진 C# ORB의 확장이 필요합니다.

관련 문제