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

When using SSL protocol, get IP and port in the program

When I use TCP protocol, I can obtain IP and port dynamically in the following ways:

auto v = adapter->getEndpoints();
auto in1 = v[0]->getInfo();
Ice::TCPEndpointInfoPtr t = Ice::TCPEndpointInfoPtr::dynamicCast(in1);

So how do I get IP and port number when I use SSL Protocol?



  • xdm
    xdm La Coruña, Spain

    EndpointInfo uses composition to provide info about the different transports, you can get the TCPEndpoint info by checking the underlying endpoint info, something like

    getTCPEndpointInfo(const Ice::EndpointInfoPtr& info)
        for(Ice::EndpointInfoPtr p = info; p; p = p->underlying)
            Ice::TCPEndpointInfoPtr tcpInfo = Ice::TCPEndpointInfoPtr::dynamicCast(p);
                return tcpInfo;
        return 0;
  • Thank you very much for your help, let me solve the problem