Function: dns-query

dns-query is an autoloaded and byte-compiled function defined in dns.el.gz.

Signature

(dns-query NAME &optional TYPE FULL REVERSE)

Documentation

Query a DNS server for NAME of TYPE.

If FULL, return the entire record returned. If REVERSE, look up an IP address.

Probably introduced at or before Emacs version 28.1.

Source Code

;; Defined in /usr/src/emacs/lisp/net/dns.el.gz
;;;###autoload
(defun dns-query (name &optional type full reverse)
  "Query a DNS server for NAME of TYPE.
If FULL, return the entire record returned.
If REVERSE, look up an IP address."
  (let* ((result nil)
         (query-started
          (dns-query-asynchronous
           name
           (lambda (response)
             (setq result (list response)))
           type full reverse)))
    (if query-started
        ;; Loop until we get the callback.
        (while (not result)
          (sleep-for 0.01)))
    (car result)))