简体   繁体   中英

How to extract the server Host/IP from the CORBA IOR & NamingContextExt? [Java]

I've got a Client who needs to send a UDP packet to a server and the only reference he has to the Server is through the CORBA naming service (IOR). I know the IOR has the Server Information embedded but is there an easy way for me to extract it?

This is the code I have so far:

Object objRef = orb.resolve_initial_references("NameService");
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
Object o = ncRef.resolve_str(Name);

After this Object o contains the IOR (if I do o.toString() it sure looks like a valid IOR), so from this what can I do to get the corresponding Servers IP/PORT so I can send it a UDP packet?

I know this sounds odd - why not just invoke the remote method, well this is for a school project and the professor recommended simply storing another table with all the sever information - but I am trying to be creative and since I was reading about the IOR I thought maybe I could do something with it ...

Any help would be much appreciated. Thanks,

Not sure if it will help, but here's the properties I use to access an IBM CORBA naming service, maybe you can try to fetch those properties from your object.

  • org.omg.CORBA.ORBInitialPort
  • org.omg.CORBA.ORBInitialHost

    export ORB_PROPERTY="-DORBNamingProvider=CosNaming -Dorg.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB -Dorg.omg.CORBA.ORBInitialPort=${ORB_PORT} -Dorg.omg.CORBA.ORBInitialHost=${ORB_HOST} -Dcom.ibm.CORBA.Debug.Output=/dev/null"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM