Results 1 to 9 of 9

Thread: Using Glacier2 with no default router

  1. #1
    rhochmuth is offline Registered User
    Name: Roland Hochmuth
    Organization: HP
    Project: RGS
    Join Date
    Aug 2003
    Posts
    86

    Using Glacier2 with no default router

    I'm a little confused about using Glacier2 without the Ice.Default.Router property being set. What I think I have to do is the following:

    1. Create an object adapter with a router specified as is documented in the example in the manual as follows:

    Ice.Default.Router=Glacier2/router:tcp -h 5.6.7.8 -p 8000

    2. Then creating a router session. When using the default router it is easy to get a a RouterPrx by just using the communicator. But when specifying a router for the object adapter there is no obvious way of getting a RouterPrx which is needed to create the session.

    I tried using the communicator as follows:

    communicatorr()->stringToProxy("Glacier2/router:ssl -h 5.6.7.8 -p 8000");

    and then casting to a RouterPrx, but this didn't appear to work for me either.

    Any suggestions?

    Regards --Roland

  2. #2
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    Quote Originally Posted by rhochmuth
    I'm a little confused about using Glacier2 without the Ice.Default.Router property being set. What I think I have to do is the following:

    1. Create an object adapter with a router specified as is documented in the example in the manual as follows:

    Ice.Default.Router=Glacier2/router:tcp -h 5.6.7.8 -p 8000

    2. Then creating a router session. When using the default router it is easy to get a a RouterPrx by just using the communicator. But when specifying a router for the object adapter there is no obvious way of getting a RouterPrx which is needed to create the session.

    I tried using the communicator as follows:

    communicatorr()->stringToProxy("Glacier2/router:ssl -h 5.6.7.8 -p 8000");

    and then casting to a RouterPrx, but this didn't appear to work for me either.

    Any suggestions?

    Regards --Roland
    For the example that you have above you need:

    - For the glacier2 configuration set:

    Glacier2.Client.Endpoints=ssl -h 5.6.7.8 -p 8000

    and then later you need the setup the ssl configuration correctly.

    - For the client application then you can use:

    communicator()->stringToProxy("Glacier2/router:ssl -h 5.6.7.8 -p 8000");

    and then cast the proxy to a router.

    Regards, Matthew

  3. #3
    rhochmuth is offline Registered User
    Name: Roland Hochmuth
    Organization: HP
    Project: RGS
    Join Date
    Aug 2003
    Posts
    86
    Hi Mathew, Thanks for the info. I mistyped the ssl and tcp in my example. I'm using ssl everywhere. My code was working when I used the Ice.Default.Router property. Here is what I'm trying to do now.

    // Get proxy to router and recast.
    Ice::ObjectPrx proxy = _communicator->stringToProxy("Glacier2/router:ssl -h 15.1.89.49 -p 8000");
    Ice::RouterPrx routerPrxy = Ice::RouterPrx::checkedCast(proxy);

    // Create the object adapter.
    std::string adapterEndpoint("tcp -p 0:ssl -p 0 -h " + ipAddress);
    adapter = _communicator->createObjectAdapterWithEndpoints(IceUtil::generat eUUID(),
    adapterEndpoint);

    // Add the router to the object adapter.
    adapter->addRouter(routerPrxy);

    ...

    // Create the router session
    Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerPrxy);
    ...

    My code is failing on the addAdapter with a ConnectionLostException.

    Regards --Roland

  4. #4
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    You get a ConnectionLostException if no session has been created, i.e., every request to Glacier2 without having created a session first will result in Glacier2 simply dropping the connection (as a security measure, to disallow any requests for unauthorized clients).

    How do you exactly create the session? Also, do you perhaps open more than one connection to Glacier2, for example, because you use proxies with different timeout settings? Since sessions are bound to connections, you must make sure that there is only one connection. You can check connection usage with network tracing (Ice.Trace.Network=2).

  5. #5
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    I also just noticed that you create the session after adding the router to the object adapter. Try to create the session first, before adding the router to the object adapter.

  6. #6
    rhochmuth is offline Registered User
    Name: Roland Hochmuth
    Organization: HP
    Project: RGS
    Join Date
    Aug 2003
    Posts
    86
    Hi Marc, Thanks for the pointer on creating the session first. That was part of the solution. I now have the router being partially used. It appears that some of my proxies are being routed correctly, and some are bypassing the router. I'm still stepping through resolving issues.

    Regards --Roland

  7. #7
    rhochmuth is offline Registered User
    Name: Roland Hochmuth
    Organization: HP
    Project: RGS
    Join Date
    Aug 2003
    Posts
    86
    You had stated that sessions are bound to connections previousely and I think that this might be a clue. When my application runs without Glacier2, I have both tcp and ssl proxies/connections being used simultaneousely. We had performance critical paths that didnt' need to be secure and non-performance critical paths that needed to be secure.

    When I use Glacier2 I'm just creating one router and one session as a result. Do I need to create two routers and two sessions?

    Currently, for all the proxies that I create, I just cast using ice_router with the same router for all proxies whether they are tcp or ssl. Interestingly, when I used the Ice.Default.Router property this all appeared to work.

    Regards --Roland

  8. #8
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    If you use a router, then the protocol settings of proxies for server objects are only relevant for the communications between the router and the server. All communications between the client and the router use the protocol settings specified by the router proxy.

    If you want client<->router communications for both TCP and SSL, then you must create two sessions, one for each of the two protocols. However, since creating a session involves sending the password along with the user-id, it is dangerous to use TCP for such communications, except in a trusted environment. On the other hand, if the environment is tusted anyway, then there is no need to use SSL. So my recommendation is to either use TCP or SSL, but not both.

    If you use a default router, then you can implicitly only use one protocol, because you can specify only one router proxy. This might explain why the behavior is different if you use a default router compared to per-proxy routers.

  9. #9
    rhochmuth is offline Registered User
    Name: Roland Hochmuth
    Organization: HP
    Project: RGS
    Join Date
    Aug 2003
    Posts
    86
    Thanks Marc, I'm up and running. It took me a little while to trace through my system. The main thing was to create the session first and then the object adapter. Once this was done I just had to be more careful creating proxies and casting correctly to use ice_router. I was also a little confused on the session discussion. It took me a litle while to understand that a router proxy is just like any other proxy in the system and that creating a session is just like authenticating.

    I'm only using ssl between the client and router so one session is working fine now. For a moment I also thought that I had to create multiple sessions since I was using ssl and tcp in the client. Thanks again for all your help and for clarifying the sessions.

    Regards --Roland

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can i config Glacier2 router multiple public ip ?
    By ren-wei in forum Help Center
    Replies: 4
    Last Post: 11-12-2010, 03:50 AM
  2. Replies: 1
    Last Post: 04-12-2010, 10:59 AM
  3. Replies: 22
    Last Post: 02-07-2006, 08:12 AM
  4. Glacier2 Router tag createSession as AMI
    By StuartA in forum Comments
    Replies: 1
    Last Post: 11-05-2005, 10:01 PM
  5. Replies: 1
    Last Post: 02-04-2005, 06:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •