locked
What is the hostent struct equivalent in Metro

    Question

  • 1. In winsock gethostbyname() return hostent struct which allow to retrieve list of addresses for the host. How can we get it Metro ?

    2. In metro using NetworkInformation::GetHostnames allows to retrieve only name.But how can i retriev corresponding address in String/Integer format like localhost->127.0.0.1-> an int no ?

    3. What is the inet_addr() equivalent in Metro?

    4. if i create a  HostName^ host=ref new ref new HostName("www.google.com"); How can I retrieve the corresponding ip address from host object?

    Monday, August 27, 2012 2:48 PM

Answers

  • Above issues is resolved..

     NetworkInformation::GetHostNames returns a list of multiple addresses for the host

    From dotted IPv4 address I parse it and get the equivalent integer from it manually.

    host->RawName returns the name from which host was created

    As HostName class can take both dotted-decimal and domain name, it is unnecessary to have such a function like inet_addr.

    Tuesday, November 27, 2012 6:19 PM

All replies

  • I'm not sure if you have multiple questions here or if you are just restating the same thing in several different ways. Can you explain what exactly you are trying to do? Why do you need the numeric address? What is the scenario you are trying to achieve?

    I don't believe there is a conversion function like you are asking for, but NetworkInformation::GetHostNames returns a list of multiple addresses for the host. One of these should be the numeric version.

    --Rob

    Tuesday, August 28, 2012 9:11 PM
    Owner
  • Above issues is resolved..

     NetworkInformation::GetHostNames returns a list of multiple addresses for the host

    From dotted IPv4 address I parse it and get the equivalent integer from it manually.

    host->RawName returns the name from which host was created

    As HostName class can take both dotted-decimal and domain name, it is unnecessary to have such a function like inet_addr.

    Tuesday, November 27, 2012 6:19 PM