Client Example
A client normally nteracts with the naming service in the following manner:
1. | It obtains an object reference by resolving the given name (using either resolve_str() or resolve()). |
2. | It narrows the object reference returned by the previous step to cast it to the correct type. |
3. | It uses the object reference. |
Listing 6.9 and Listing 6.10 show sample clients in C++ and Java that use the naming service to look up the StockExchange object.
Listing 6.9. C++ Client Resolving a Name
// C++ ... int main (int argc, char *argv[]) { ... //------------------------------------------------------------------ // The usual initialization boilerplate comes here (not shown). // The following variables are defined by the initialization code: // // ... |
Get Pure CORBA now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.