«^»
3.6. Communicating with a Naming Service by using its IOR

It is also possible for the server program and/or the client program to use an IOR to contact the Naming Service rather than contact it through the information given by ORBInitialHost and ORBInitialPort. If we start the Naming Service by the command:

nameserv -ORBInitialPort 1050 | tee nameserv.ior &
the lines that nameserv outputs will be captured in the file nameserv.ior. Then instead of using:
java IDL.Count.CountServer -ORBInitialPort 1050 &
java IDL.Count.CountClient -ORBInitialHost hercules.dur.ac.uk -ORBInitialPort 1050
to tell CountServer and CountClient where the Naming Service is, we can pass the IOR of the Naming Service as the first argument of the command line being used to run these programs:
java IDL.CountNSIOR.CountServer `grep IOR nameserv.ior` &
java IDL.CountNSIOR.CountClient `grep IOR nameserv.ior`
In order to get at this IOR, the statement of CountServer that says:
0107:          org.omg.CORBA.Object objRef = 
0108:                     orb.resolve_initial_references("NameService");
has to be changed to:
0244:          org.omg.CORBA.Object objRef = orb.string_to_object(args[0]);
A similar change has to be made to the CountClient program.

The complete texts of the programs where an IOR is used to contact the Naming Service are at http://www.dur.ac.uk/barry.cornelius/papers/IDL/CountNSIOR/.