Method code for $dns.ip()

[Turn off line numbering]
  1: arg hostname;
  2: var c, line, result;
  3: 
  4: if (!hostname)
  5:     return pass();
  6: if (hostname != "localhost" && !match_regexp(hostname, valid_host_regexp))
  7:     throw(~address, "Invalid Internet Address: \"" + hostname + "\"");
  8: if (!async)
  9:     return pass(hostname);
 10: if (!valid(connection)) {
 11:     if (!.restart())
 12:         return pass(hostname);
 13: }
 14: connection = connection.write(task_id() + ":R:" + hostname);
 15: result = $scheduler.suspend(this());
 16: if (type(result) != 'list || listlen(result) != 2)
 17:     return "";
 18: switch (result[1]) {
 19:     case "N":
 20:         throw(~address, result[2]);
 21:     case "F":
 22:         throw(~failed, result[2]);
 23:     case "G":
 24:         return result[2];
 25:     default:
 26:         $sys.log("DNS ERROR: Invalid result: " + result.join(":"));
 27: }

// Created 01-Jul-1997 as a part of ColdCore, see: @help Credit

Method Ancestry Override:

 ----  182 $dns.ip(hostname)
 ---n    1 $network.ip()

Tlon