src/main/java/pityoulish/tutorial/TutorialCommandHandler.java
protected int handleLookupCmd(String hostname)
   {
     System.out.println(Catalog.LOOKING_UP_1.format(hostname));

     // PYL:keep
     Missing.here("look up the InetAddress(es) of a hostname");
     // Use formatInetAddress below to print all the addresses.
     // Also handle the case when the hostname has no address at all.
     // PYL:cut
     try {
       for (InetAddress ina : InetAddress.getAllByName(hostname))
        {
          System.out.println(formatInetAddress(ina));
        }
     } catch (java.net.UnknownHostException uhx) {
       System.out.println(uhx.getMessage()); // no need for the stack trace
     }
     // PYL:end

     return 0;
   }
/**
   * Performs a DNS lookup on a hostname and prints the results.
   *
   * @param hostname    the hostname or string-encoded IP address
   *                    for which to perform a DNS lookup
   *
   * @return status code, 0 for success
   */
Performs a DNS lookup on a hostname and prints the results.
@param hostname    the hostname or string-encoded IP address
for which to perform a DNS lookup

@return status code, 0 for success
Performs a DNS lookup on a hostname and prints the results . @param hostname the hostname or string - encoded IP address for which to perform a DNS lookup @return status code 0 for success
protected int handleLookupCmd(String hostname)
   {
     System.out.println(Catalog.LOOKING_UP_1.format(hostname));
     Missing.here("look up the InetAddress(es) of a hostname");
     try {
       for (InetAddress ina : InetAddress.getAllByName(hostname))
        {
          System.out.println(formatInetAddress(ina));
        }
     } catch (java.net.UnknownHostException uhx) {
       System.out.println(uhx.getMessage()); 
     }
     return 0;
   }
protected int handleLookupCmd ( String hostname ) { System . out . println ( Catalog . LOOKING_UP_1 . format ( hostname ) ) ; Missing . here ( "look up the InetAddress(es) of a hostname" ) ; try { for ( InetAddress ina : InetAddress . getAllByName ( hostname ) ) { System . out . println ( formatInetAddress ( ina ) ) ; } } catch ( java . net . UnknownHostException uhx ) { System . out . println ( uhx . getMessage ( ) ) ; } return 0 ; }
Performs a DNS lookup on a hostname and prints the results.
Performs a DNS lookup on a hostname and prints the results .
// PYL:keep // Use formatInetAddress below to print all the addresses. // Also handle the case when the hostname has no address at all. // PYL:cut // no need for the stack trace // PYL:end