简体   繁体   English

如何从CORBA IOR和NamingContextExt中提取服务器Host / IP? [Java]

[英]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). 我有一个需要将UDP数据包发送到服务器的客户端,并且他对服务器的唯一引用是通过CORBA命名服务(IOR)。 I know the IOR has the Server Information embedded but is there an easy way for me to extract it? 我知道IOR嵌入了服务器信息,但是我有一种简单的方法来提取它吗?

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? 在此对象o包含IOR之后(如果我执行o.toString(),则它肯定看起来像是有效的IOR),因此从中我该怎么做以获取相应的服务器IP / PORT,以便可以向其发送UDP数据包?

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 ... 我知道这听起来很奇怪-为什么不只是调用远程方法,这是针对学校项目的,教授建议仅存储包含所有服务器信息的另一张表-但我正在尝试发挥创造力,因为我正在阅读有关IOR的信息我以为也许我可以做点什么...

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. 不确定是否会有所帮助,但是这是我用来访问IBM CORBA命名服务的属性,也许您可​​以尝试从对象中获取这些属性。

  • org.omg.CORBA.ORBInitialPort org.omg.CORBA.ORBInitialPort
  • org.omg.CORBA.ORBInitialHost 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" 导出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“

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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