ACE+TAO Opensource Programming Notes/Attaching your applications to the core services

Ok, so we now have a client and server along with services... let's wire them up.

If you have an already compiled server from one of the previous examples, you'll want to start that up first and have it advertised on the naming service. To do that, you'll need to tell the server you wrote the IOR of the naming service. TAO allows you two ways to do this. The first is to create an environment variable "NameServiceIOR" which you assign the IOR you used when you started the NamingService. The other method, is to put the IOR on the command line. The IOR from the example below is the string starting with "corbaloc" and continuing to the end of the line. The latter option is my preferred method to get a server started.

./YourServer -ORBInitRef NameService=corbaloc:iiop:yoyodyne.com:12345/NameService

The -ORBInitRef option is simply passed to the CORBA::ORB_init function in the opening lines of your application, so you could optionally pass this in directly to the function, thus obviating the need for this long command line. In practice, however, I've always used this long command line form as it makes it easier to move the app around.

To start the client side, using the command line from above is fine.

./YourClient -ORBInitRef NameService=corbaloc:iiop:yoyodyne.com:12345/NameService

One final note unrelated to connecting your apps into the framework. The ACE+TAO framework, because it was designed to work on Microsoft's platform, comes with a non-standard way to start up the app. If you want to run your shiny new app as a daemon, you need to add -ORBDaemon to the command line. If you are doing this under linux, don't try the daemon C function call in your source, it'll only serve to confuse things.