javanetwork-programminglocalhostclient-serverhostname

What is the returned hostname when client is localhost?


I am applying a simple client server tutorial in Java as follows:

public class Client{
    public static void main(String[] args) throws IOException{
        Socket s = new Socket("localhost", 8080);
        s.close();
    }
}
public class Server{
    public static void main(String[] args) throws IOException, ClassNotFoundException{
        ServerSocket ss = new ServerSocket(8080);
        Socket s = ss.accept();
        InetAddress inetAddress = s.getInetAddress();
        System.out.println("Client's host name is " + inetAddress.getHostName());
        System.out.println("Client's IP Address is " + inetAddress.getHostAddress());
        ss.close();     s.close();
    }
}

As shown, there is a couple of lines to get the hostname and address of connected client in the server code. When running on my computer (localhost) the IP is correct as 127.0.0.1 but the hostname is confusing for me:

Client's host name is lm.licenses.adobe.com
Client's IP Address is 127.0.0.1

Why the hostname of my computer (localhost) is read as Adobe?


Solution

  • Check your computer's hosts file to see if there is an entry associating the IP address 127.0.0.1 with the hostname "lm.licenses.adobe.com". The hosts file is typically located at C:\Windows\System32\drivers\etc\hosts on Windows or /etc/hosts on Unix-based systems.

    Open the hosts file and ensure that there are no unexpected entries associating 127.0.0.1 with "lm.licenses.adobe.com".