3

I have application in CORBA using IIOP protocol, i am using the Java IDL component of the JDK 6 , another ORB implementation.

Implementation of both client and server in Java language.

Is there any way in the JDK ORB implementation to get the client ORB`s host and port from the server (ORB)code ?

Or

is there any way with use of IIOP protocol, get client the host and port ?

This is we are doing for identification of the client to track the who is requested

ajduke
  • 4,991
  • 7
  • 36
  • 56
  • Can you explain your *problem* better? I think you resolve your problem in a different way. – Makah Feb 14 '13 at 12:25

3 Answers3

2

I don't think there is any portable way to do this. Perhaps there is for your particular ORB, I don't know. Recall that CORBA tries very hard to hide the transport details from the application. The application may not even be using IIOP, and thus there would be no way to get TCP host and port information in any event.

You may want to consider adding additional identifier parameter(s) to your IDL so that the server can recognize clients. You may also consider making the clients call a "register" function on the server, and the server hands out an identifier that all clients must pass back to the server on subsequent calls.

This identifier can be as simple as a string or integer, or as complicated as some kind of security token that the server has to validate with a public key. It all depends on your application's requirements.

Brian Neal
  • 31,821
  • 7
  • 55
  • 59
  • thats the another options, i am having . But, wanted some native support from IIOP protocol itself for this problem – ajduke Jan 24 '13 at 04:58
  • 3
    The whole idea behind CORBA is that an application does not need to know the transport details. Therefore there is no portable way to get this information. For example, I could be running CORBA on top of another transport besides IIOP, one where the addressing details are completely different to TCP/IP. – Brian Neal Jan 24 '13 at 21:42
  • Surely, nobody prevents from asking the caller to pass own IP as a string parameter but this is awfully insecure up to level it is not clear why should be done at all (I can pass any IP I can imagine). It may be better to ask for registering the exported object reference instead, then host:port can be obtained from that reference as described in my post. – Audrius Meškauskas Jan 26 '13 at 11:30
  • 1
    @AudriusMeškauskas No one mentioned security. He needed a way to identify clients and this is probably the only way to do it portably in CORBA. You don't have to pass the IP address as the identifier, you could pass some hashed secure token that the server can verify. And remember IOR's can be spoofed also. – Brian Neal Jan 26 '13 at 16:11
  • 1
    @AudriusMeškauskas Also, some clients may be pure client-only, and not even have an IOR to register. – Brian Neal Jan 26 '13 at 16:57
  • ORB.object_to_string() should anyway return something also for such objects, even if they implementations are hooked on the same ORB. But the client needs to export self as the CORBA object and pass this self-reference during registration. – Audrius Meškauskas Jan 26 '13 at 18:15
  • 1
    @AudriusMeškauskas If a registration step is an admissible answer, the client might as well just supply its IP address instead of an IOR and cut out all the malarkey. – user207421 Jan 27 '13 at 05:44
  • I conclude that there is no solution for this problem due policies taken during CORBA design. – Audrius Meškauskas Jan 27 '13 at 10:20
  • If you're doing this per request/response, you could use portable interceptors to put a handshake in the request/response service contexts.. (i.e. use service contexts, instead of relying on the IOR) – ebullient Feb 14 '14 at 19:14
1

It depends on the situation but sometimes you need to extract host/port from IOR for testing, logging, debugging purposes. IOR contains host and port, you only need to decode it from byte array that IOR represents. So just take CORBA specification and IorParser.java(massive dependencies) from GNU Classpath as example and do decoding yourself if you have time during weekend :)

If you do not have time as me, you can use command line utilities that are coming with ORBs:

  1. tao_catior in TAO/ACE ORB
  2. iordump in Orbix/Orbacus ORB's
  3. Parse IOR with web online tool http://www2.parc.com/istl/projects/ILU/parseIOR/
  4. Have not found possibility to use JDK CORBA to do the parsing. Although the code is definitely somewhere in internal sun packages.
  5. dior in Jacorb ORB. Or java jacorb.Orb.util.PrintIOR -i [IOR-string]

For me the answer #5 was good enough. I used Jacorb for my java based testing tool. But then again PrintIOR requires org.jacorb.orb.ORB to be instantiated by org.omg.CORBA.ORB.init(). So it can be tricky if you are forced to use JDK ORB in the same JVM.

user118228
  • 11
  • 1
0

This is duplicated by Identify client in peer to peer filesharing using Java and Corba. And build socket socket between 2 Clients

There is a solution given based on JacORB.

weberjn
  • 1,840
  • 20
  • 24