Results 1 to 2 of 2

Thread: FAQ contains incorrect code?

  1. #1
    oliverk is offline Registered User
    Name: Oliver Kozber
    Organization: Synopsys
    Project: Electronic Design Automation Tools
    Join Date
    Apr 2010
    Posts
    2

    FAQ contains incorrect code?

    I looked at the FAQ: "How can a server get the IP address of the caller"

    I'm using the latest 3.4. Here is what it lists:

    > Ice::ConnectionInfo info = c.con->getInfo();

    getInfo() does not return Ice::ConnectionInfo ?

    > Ice::TCPConnectionInfo tcpInfo =
    > Ice::TCPConnectionInfo::dynamicCast(c.con);

    There is no TCPConnectionInfo and no dynamicCast?

    if(ipInfo)
    {
    ...

    Where is ipInfo defined?

    Please explain what I'm missing.

    Thanks,

    -Oliver

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,445
    Hi Oliver,

    Welcome to the forum!

    There are a few bugs in that example code, thanks for bringing this to our attention. I've fixed the FAQ, and here's what the code should have been:
    Code:
        if(c.con)
        {
            Ice::ConnectionInfoPtr info = c.con->getInfo();
            Ice::TCPConnectionInfoPtr tcpInfo =
                Ice::TCPConnectionInfoPtr::dynamicCast(info);
            if(tcpInfo)
            {
                cout << "local address = " << tcpInfo->localAddress << ":"
                     << tcpInfo->localPort << endl;
                cout << "remote address = " << tcpInfo->remoteAddress << ":"
                     << tcpInfo->remotePort << endl;
            }
        }
    I've verified that this compiles.

    Let us know if you still have questions.

    Regards,
    Mark

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 12-15-2009, 08:36 PM
  2. IcePy segfaults on incorrect router configuration
    By vsevolod in forum Bug Reports
    Replies: 1
    Last Post: 10-27-2009, 11:29 AM
  3. Replies: 1
    Last Post: 11-28-2003, 03:11 PM
  4. Some FAQ Entries To Consider
    By Ken Carpenter in forum Comments
    Replies: 0
    Last Post: 03-06-2003, 02:39 AM
  5. An FAQ Forum
    By Ken Carpenter in forum Comments
    Replies: 0
    Last Post: 03-06-2003, 02:27 AM

Posting Permissions

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