Is it possible in windows store app to get the Host name from an IP address. ? RRS feed

  • Question

  • Suppose  www.example.com 's IP address in XXX.XXX.XXX.XXX.

    I know only the IP address.

    Is there any way ,I can get the host name www.example.com from the IP address using Windows store app socket APIS.

    I tried to get hostname from the socket Information after connecting with the IP.But it returns me the IP address i am using.

    So,Is there any way to do this task in windows store app.Getting the host+domain name  from an IP address.

    I need this procedure because in TLS/SSL connection i am not allowed to use the IP address.I have to use the hostname .SSL/TLS connection failed with IP address.


    Wednesday, May 8, 2013 5:34 AM

All replies

  • Hi,

    I found a thread talking about this, hope it can help you

    private async void LookupIP(string hostname)
                HostName host = new HostName(hostname);
                StreamSocket clientSocket = new Windows.Networking.Sockets.StreamSocket();
                // Try to connect to the remote host
                await clientSocket.ConnectAsync(host, "http");
                txtIP.Text = clientSocket.Information.RemoteAddress.DisplayName;

    Best regards,

    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 9, 2013 3:16 AM
  • Hi Jesse,

    May be you get me wrong . You give me the solution for getting IP address if you know the Host name . But I am wanting the  reverse . That means , I know the IP address, I want to know the host address.

    After connecting with a remote  IP address ,I am not finding the remote hostname from socket information.

    Thursday, May 9, 2013 4:42 AM
  • I think that this might be what you're looking for:

    private async Task<string> DoDns(string remoteHostName)
        IReadOnlyList<EndpointPair> data = await DatagramSocket.GetEndpointPairsAsync(new HostName(remoteHostName), "0");
        EndpointPair p = data[0];
        return p.RemoteHostName.DisplayName; 

    Friday, December 13, 2013 6:51 PM
  • I need not reverse DNS resolve anymore . In windows 8.1 SDK SSL/TLS connection error can be ignored using IgnorableServerCertificateErrors.

    So,SSL/TLS connection is now possible only knowing the servers IP address.So,I don't require domain name because now i can ignore name related error in TLS/SSL connection.

    Tuesday, March 11, 2014 6:28 PM