Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Node.js – dns.resolvePtr() Method
The dns.resolvePtr() method uses the DNS protocol to resolve the pointer records (PTR Records) for the hostname. The addresses argument passed to the callback function will contain the reply records as an array of strings.
Syntax
dns.resolvePtr(hostname, callback)
Parameters
hostname - This parameter takes the input for the hostname to be resolved.
-
callback - This function will catch errors, if any.
records − Returns PTR records for the hostname.
Example 1
Create a file with the name "resolvePtr.js" and copy the following code. After creating the file, use the command "node resolvePtr.js" to run this code as shown in the example below
// dns.resolvePtr() Demo Example
// Importing the dns module
const dns = require('dns');
// Passing the argument below
dns.resolvePtr('tutorialspoint.com', (err,records) => console.log('PTR Records: %j', records));
Output
PTR Records: undefined
Example 2
Let's take another example −
// dns.resolvePtr() Demo Example
// Importing the dns module
const dns = require('dns');
// Passing the argument below
dns.resolvePtr('stackoverflow.com', (err, records) => console.log('PTR Records: %j', records));
Output
PTR Records: undefined
Advertisements
