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

Ice (С++) quetion about SessionFactory interface

I use Ice 3.4.2 in my client-server application (С++), which creates sessions on the server-side with Session and SessionFactory interfaces like in your example "sessions".
Can you suggest, how can i interchange server's and client's roles to make remote call from server to client? Must i create new slice interface for this call? And how can i bind SessionFactory object and object of new interface?



  • xdm
    xdm La Coruña, Spain
    Hi Alex,

    There are several ways to do that:

    At first the simpler will be that the client creates an "object adapter" adds a servant to it, and the server can call to that object. The downside is that you will need to deal with the client firewall.

    To avoid managing the client firewall you can use Ice bidirectional connections, the client still needs to create an object adapter, and register a servant, but it don't need to assign the adapter endpoints or deal with the client firewall, instead the client object adapter is configured to reuse the connection that was previously opened to the server, an the client can receive invocations throw this connection, see demo/Ice/bidir demo included in Ice distributions.

    If you are using session objects, and now want to use bidirectional connections, this sound like a good use case for Glacier2, Glacier2 is a lightweight firewall traversal solution for Ice applications. Take a look to Glacier2 documentation, also take a look to demo/Glacier2/session and demo/Glacier2/callback demos included in Ice distributions.

    For a more elaborate example of using Glacier2, sessions and bidirectional connections i suggest to take a look to Chat Demo, the articles provide great detail of the design.

  • Hi, José!
    Thank you for your help!