0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/mjsunit/disabled/test-dns.js
2009-12-06 09:26:09 +01:00

30 lines
875 B
JavaScript

process.mixin(require("../common"));
var dns = require("dns");
for (var i = 2; i < process.ARGV.length; i++) {
var name = process.ARGV[i]
puts("looking up " + name);
var resolution = dns.resolve4(name);
resolution.addCallback(function (addresses, ttl, cname) {
puts("addresses: " + JSON.stringify(addresses));
puts("ttl: " + JSON.stringify(ttl));
puts("cname: " + JSON.stringify(cname));
for (var i = 0; i < addresses.length; i++) {
var a = addresses[i];
var reversing = dns.reverse(a);
reversing.addCallback( function (domains, ttl, cname) {
puts("reverse for " + a + ": " + JSON.stringify(domains));
});
reversing.addErrback( function (code, msg) {
puts("reverse for " + a + " failed: " + msg);
});
}
});
resolution.addErrback(function (code, msg) {
puts("error: " + msg);
});
}