Archived

This forum has been archived. Please start a new discussion on GitHub.

Adding an Object to Adapter

Hello again,

I am attempting to modify the Ice/Hello demo to work with an IcePack registry and have servers be able to talk to clients across the network via tcp. So far I have been able to do that, but I would like to be able to run more than one server per adapter (there is currently one adapter per node). In other words, how do I add another object to the ASM for an object adapter?

I have tried creating a slightly modified server/client of hello, but have hit upon a stumbling block code-wise: how do I get a pointer to the local adapter (assuming it has been created) with a previous instance of the hello server. I am still using the createObjectAdapter(...) for the first one. I have gone through the includes and the documentation, but I cannot seem to find how to get that information from the communicator passed as an argument to the Hello object. For simplicity, here is the basic layout of what I have working now:

Host A:
IceRegistry (tcp only)
Ice/Hello server on Hello adapter
Ice/Hello client on Hello1 adapter (talks to Host B)

Host B:
Ice/Hello server on Hello1 adapter
Ice/Hello client on Hello adapter

What I'd like to add is another Hello client-server pair, client on one host, server on another without having to add another adapter. Thank you for all of your help.

Jennie

Comments

  • You can simply remember the adapter proxy that is returned from createObjectAdapter and pass that proxy around or store it in a member variable.

    Alternatively, within the context of an executing operation within the server, you can look at the Current object which contains the adapter that was used to dispatch the request (see section 20.5 in the doc).

    Cheers,

    Michi.
  • mes
    mes California
    Jennie,

    With respect to IcePack, there is a one-to-one relationship between adapters and servers, therefore you cannot have an adapter with the same id created by more than one server.

    Take care,
    - Mark
  • Thank You

    Mark and Michi,

    Thank you, that clears up my question.

    Jennie