阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js dns dnsPromises.lookupService

      Node.js dns dnsPromises.lookupService(address, port)

      新增于: v10.6.0

      • address < string>
      • port < number>

      Resolves the given address and port into a hostname and service using the operating system’s underlying getnameinfo implementation.

      If address is not a valid IP address, a TypeError will be thrown. The port will be coerced to a number. If it is not a legal port, a TypeError will be thrown.

      On error, the Promise is rejected with an Error object, where err.code is the error code.

      const dnsPromises = require('dns').promises;
      dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
        console.log(result.hostname, result.service);
        // Prints: localhost ssh
      });
      

      更多内容请参考:Node.js dns 域名服务器,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录