I need something like get-host-by-name
or getent-hosts
but I can not find any. Do they exist?
2
1
There is dns.el
, which was in Gnus for a while but has long since been moved into the more general net
subdirectory of lisp
. This library seems to implement its own resolver. (It may call nslookup
only to get your DNS resolver address(es), if you don't set dns-servers
and /etc/resolv.conf
cannot be found.)
(dns-query "www.google.com") ; => "216.58.216.196"
-
Please do not refer to anything in comments, in your answer. Comments can be deleted anytime. Instead, incorporate the material you want from comments, and attribute relevant parts to users who contributed it. Thx. – Drew Mar 4 at 0:05
-
dns-lookup-host
. – Juancho Jan 12 '17 at 16:39net-utils
also just callsdig
. That is what I am now doing in my work-around. – ceving Jan 12 '17 at 17:00dnsResolve
(inurl-ns.el
) tries to callnslookup
. – JeanPierre Jan 12 '17 at 17:15url-gateway-nslookup-host
, which will chose the utility to call based on your settings (which, I imagine, are influenced by your OS), however, as far as I know, Emacs itself doesn't have its own low-level networking libraries and relies on the system to provide these services. However, if you want to do this on Linux, and you don't want to rely on the presence of any utility, you could still do it by reading / writing to /dev/tcp: linuxjournal.com/content/… – wvxvw Jan 13 '17 at 9:32