File System Demo Explanation

eric.hilleric.hill Member Eric HillOrganization: Pioneer Balloon Co.Project: Internal Research
I'm reading through the Ice PDF manual and have a question.

In the "developing a file system client" section, there is the following snippit of code:

Ice::ObjectPrx base = ic->stringToProxy("RootDir:default -p 10000");

That would indicate to me that this is building a proxy for the "RootDir" servants' default facet on port 10000, and since host isn't specified, it assumes localhost, right?

Then in the "developing a file system server" section, there is the following code:

NodeI::_adapter = communicator()->createObjectAdapterWithEndpoints("SimpleFilesystem", "default -p 10000");

This would indicate to me that the adapter is listening on port 10000 (good) and on all local interfaces (also good) but with a servant name of "SimpleFilesystem".

How does the client connect to the server when the client is looking for RootDir and the server is called SimpleFilesystem?

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    This line:
    NodeI::_adapter = communicator()->
    createObjectAdapterWithEndpoints("SimpleFilesystem", "default -p 10000");
    
    creates an object adapter with the name "SimpleFilesystem". It does not create an Ice object with this name by adding a servant to this object adapter.

    BTW, can you please update your signature with your company or organization name?
  • eric.hilleric.hill Member Eric HillOrganization: Pioneer Balloon Co.Project: Internal Research
    That Explains A Bit

    Thanks for the explanation Marc.

    So where in the code on page 278 and 279 does the servant get created and added to the adapter? Is it just missing from the example, or am I missing it?

    FYI, I added the company I work for to my sig, though I'm looking at Ice for an on-the-side project... :)
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    In the constructor of NodeI. See page 288-289.
  • eric.hilleric.hill Member Eric HillOrganization: Pioneer Balloon Co.Project: Internal Research
    Perfect

    Now I see it - it generates a random name if it's not the root node, otherwise the magical "RootDir" name is used. Thanks for walking me through this - there's a lot to learn...
Sign In or Register to comment.