- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Node.js – dns.resolveSoa() Method
The dns.resolveSoa() method uses the DNS protocol to resolve the start of authority records for the hostname. The address argument passed to the callback function will be an object that will contain the following properties −
- nsname
- hostmaster
- serial
- refresh
- entry
- expire
Syntax
dns.resolveSoa(hostname, callback)
Parameters
It accepts the following parameters −
hostname – This parameter takes the input for the hostname to be resolved.
callback – This function will catch errors, if any.
records – Returns the start of authority records for the hostname.
Example
Create a file with the name "resolveSoa.js" and copy the following code snippet. After creating the file, use the command node "resolveSoa.js" to run this code as shown in the example below −
// dns.resolveSoa() Demo Example // Importing the dns module const dns = require('dns'); // Passing the argument below dns.resolveSoa('tutorialspoint.com', (err, records) => console.log('SOA Records: %j', records));
Output
C:\home
ode>> node resolveSoa.js SOA Records: { "nsname":"ns-1033.awsdns-01.org", "hostmaster":"awsdns-hostmaster.amazon.com", "serial":1, "refresh":7200, "retry":900, "expire":1209600, "minttl":86400 }
Advertisements
To Continue Learning Please Login
Login with Google