|
@ -1199,13 +1199,17 @@ Disables the Nagle algorithm. By default TCP connections use the Nagle |
|
|
algorithm, they buffer data before sending it off. Setting +noDelay+ will |
|
|
algorithm, they buffer data before sending it off. Setting +noDelay+ will |
|
|
immediately fire off data each time +connection.send()+ is called. |
|
|
immediately fire off data each time +connection.send()+ is called. |
|
|
|
|
|
|
|
|
=== DNS |
|
|
=== DNS module |
|
|
|
|
|
|
|
|
|
|
|
Use +require("/dns.js")+ to access this module |
|
|
|
|
|
|
|
|
Here is an example of which resolves +"www.google.com"+ then reverse |
|
|
Here is an example of which resolves +"www.google.com"+ then reverse |
|
|
resolves the IP addresses which are returned. |
|
|
resolves the IP addresses which are returned. |
|
|
|
|
|
|
|
|
------------------------------------------------------------------------- |
|
|
------------------------------------------------------------------------- |
|
|
var resolution = node.dns.resolve4("www.google.com"); |
|
|
var dns = require("/dns.js"); |
|
|
|
|
|
|
|
|
|
|
|
var resolution = dns.resolve4("www.google.com"); |
|
|
|
|
|
|
|
|
resolution.addCallback(function (addresses, ttl, cname) { |
|
|
resolution.addCallback(function (addresses, ttl, cname) { |
|
|
puts("addresses: " + JSON.stringify(addresses)); |
|
|
puts("addresses: " + JSON.stringify(addresses)); |
|
@ -1214,7 +1218,7 @@ resolution.addCallback(function (addresses, ttl, cname) { |
|
|
|
|
|
|
|
|
for (var i = 0; i < addresses.length; i++) { |
|
|
for (var i = 0; i < addresses.length; i++) { |
|
|
var a = addresses[i]; |
|
|
var a = addresses[i]; |
|
|
var reversing = node.dns.reverse(a); |
|
|
var reversing = dns.reverse(a); |
|
|
reversing.addCallback( function (domains, ttl, cname) { |
|
|
reversing.addCallback( function (domains, ttl, cname) { |
|
|
puts("reverse for " + a + ": " + JSON.stringify(domains)); |
|
|
puts("reverse for " + a + ": " + JSON.stringify(domains)); |
|
|
}); |
|
|
}); |
|
@ -1230,7 +1234,7 @@ resolution.addErrback(function (code, msg) { |
|
|
------------------------------------------------------------------------- |
|
|
------------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+node.dns.resolve4(domain)+:: |
|
|
+dns.resolve4(domain)+:: |
|
|
|
|
|
|
|
|
Resolves a domain (e.g. +"google.com"+) into an array of IPv4 addresses (e.g. |
|
|
Resolves a domain (e.g. +"google.com"+) into an array of IPv4 addresses (e.g. |
|
|
+["74.125.79.104", "74.125.79.105", "74.125.79.106"]+). |
|
|
+["74.125.79.104", "74.125.79.105", "74.125.79.106"]+). |
|
@ -1241,11 +1245,11 @@ This function returns a promise. |
|
|
- on error: returns +code, msg+. +code+ is one of the error codes listed |
|
|
- on error: returns +code, msg+. +code+ is one of the error codes listed |
|
|
below and +msg+ is a string describing the error in English. |
|
|
below and +msg+ is a string describing the error in English. |
|
|
|
|
|
|
|
|
+node.dns.resolve6(domain)+:: |
|
|
+dns.resolve6(domain)+:: |
|
|
|
|
|
|
|
|
The same as +node.dns.resolve4()+ except for IPv6 queries (an +AAAA+ query). |
|
|
The same as +dns.resolve4()+ except for IPv6 queries (an +AAAA+ query). |
|
|
|
|
|
|
|
|
+node.dns.reverse(ip)+:: |
|
|
+dns.reverse(ip)+:: |
|
|
|
|
|
|
|
|
Reverse resolves an ip address to an array of domain names. |
|
|
Reverse resolves an ip address to an array of domain names. |
|
|
|
|
|
|
|
@ -1258,12 +1262,12 @@ Reverse resolves an ip address to an array of domain names. |
|
|
|
|
|
|
|
|
Each DNS query can return an error code. |
|
|
Each DNS query can return an error code. |
|
|
|
|
|
|
|
|
- +node.dns.TEMPFAIL+: timeout, SERVFAIL or similar. |
|
|
- +dns.TEMPFAIL+: timeout, SERVFAIL or similar. |
|
|
- +node.dns.PROTOCOL+: got garbled reply. |
|
|
- +dns.PROTOCOL+: got garbled reply. |
|
|
- +node.dns.NXDOMAIN+: domain does not exists. |
|
|
- +dns.NXDOMAIN+: domain does not exists. |
|
|
- +node.dns.NODATA+: domain exists but no data of reqd type. |
|
|
- +dns.NODATA+: domain exists but no data of reqd type. |
|
|
- +node.dns.NOMEM+: out of memory while processing. |
|
|
- +dns.NOMEM+: out of memory while processing. |
|
|
- +node.dns.BADQUERY+: the query is malformed. |
|
|
- +dns.BADQUERY+: the query is malformed. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|