This Java tip demonstrates a method of determining the IP address and hostname of the local machine. Developer may use this for internal processing in their applications. This may be implemented on the client side to send the IP address and their hostname to the server.

 try {

        InetAddress addr = InetAddress.getLocalHost();
    
        // Get IP Address
        byte[] ipAddr = addr.getAddress();
    
        // Get hostname
        String hostname = addr.getHostName();

    } catch (UnknownHostException e) {
    }