passing a proxy created using localhost as part of the proxy string

halfhphalfhp Member Nick FellowsOrganization: AoptixProject: optical comms appliance ✭✭
If I create a proxy of an object in a process running on computer A using localhost as the host parameter passed to stringToProxy(getRemoteProxyString(...)) and pass that proxy as a parameter to a process on computer B, will that proxy be usable by processes on computer B? Or do I need to explicitly declare which interface I want to make the object available on? If so, what if I want to make the object available across multiple or all interfaces?

Thanks,
Nick

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    I'm not sure what you're trying to achieve. Can you detail it a bit more? Why do you want to pass proxies as strings? This is most of the time bad practice. You should pass proxies as proxies instead :). For an example, see the demo/Ice/callback demo from your Ice distribution.

    Cheers,
    Benoit.
  • halfhphalfhp Member Nick FellowsOrganization: AoptixProject: optical comms appliance ✭✭
    Hi Benoit,

    I don't want to pass proxies as strings - apologies if my initial post was vague. My question is actually bout the proxy objects that I am passing and whether or not the string I use to create them affects one's ability to use them remotely.

    I have a series of processes that use Ice to communicate. Everything works great when all of the processes are colocated on one computer. When I move one of the processes to another computer however, it breaks any methods I have which pass proxies around. This question comes from me theorizing that when creating a proxy of a local ice instance via stringtoproxy using "127.0.0.1" as part of the string causes that instance to be bound to the loopback interface and thus unusable by the outside world.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Ok, I see. If you create proxies using the 127.0.0.1 address then yes that is also what will be passed to other Ice applications when passing the result of stringToProxy. The stringToProxy method doesn't have any magic to transform addresses or any other components of the stringified proxy: it is a simple transform of the string to a programatic Ice proxy object.

    I wonder why you need to create proxies from strings however. This should be mostly needed for a small number of proxies, typically for configurable proxies (stored in a text configuration file). Usually proxies are then obtained when servants are registered with the Ice object adapter (the add or addWithUUID methods return a proxy). You can also create proxies using the createProxy method of the Ice object adapter. The proxies returned by those methods contain the endpoints of the object adapter (configured with the object adapter Endpoints property).

    Cheers,
    Benoit.
  • halfhphalfhp Member Nick FellowsOrganization: AoptixProject: optical comms appliance ✭✭
    That sounds like my problem then. I don't have a good understanding of what Ice does behind the scenes and was naively expecting that the process of obtaining a proxy from a string simply told the ice runtime who to talk to in order to retrieve the proxy...I did't realize that it actually just create the proxy on the spot with a hardcoded endpoint. (I assumed that the process of passing by proxy resulted in the proxy being configured at the time of sending with endpoint info corresponding to whichever interface the proxy was sent out over.)

    At the time the original code was written, wet had abou 7 ice objects with one instance each that needed to be proxied and up until now they all lived together on one system. Hardcoding the strings seemed like the most straightforward solution.

    One final question: If one is using Ice on a system with multiple interfaces (we have 4) and one creates a new proxy using the createProxy method, will the resulting proxy be passable to any of the ice environments living on the other side of those interfaces? Just to clarify - by interface I mean a physical network card which has it's own entries in the computer's routing table which cannot be reached via the other interfaces.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Nick,

    You can find a lot of information about proxies in this Proxies article (perhaps too much information!).

    A proxy just encapsulates information on how to reach a remote object. Creating a proxy or passing a proxy through an operation is a cheap local call that does not trigger any connection establishment or remote processing.
    One final question: If one is using Ice on a system with multiple interfaces (we have 4) and one creates a new proxy using the createProxy method, will the resulting proxy be passable to any of the ice environments living on the other side of those interfaces? Just to clarify - by interface I mean a physical network card which has it's own entries in the computer's routing table which cannot be reached via the other interfaces.

    This all depends on your object adapter configuration, adapter.Endpoints and adapter.PublishedEndpoints

    See "32.4.6 Endpoints" in Object Adapters

    Best regards,
    Bernard
Sign In or Register to comment.