DNS query: Difference between revisions

m
Regularize non-standard header markup
m (Changed order of addresses in output.)
m (Regularize non-standard header markup)
Line 321:
IPv6 address = 2001:200:DFF:FFF1:216:3EFF:FEB1:44D7</pre>
 
== {{header|C}} ==
This solution uses <code>getaddrinfo()</code>, a standard function from RFC 3493. This code resembles an example from [http://www.openbsd.org/cgi-bin/man.cgi?query=getaddrinfo&apropos=0&sektion=3&manpath=OpenBSD+Current&arch=i386&format=html getaddrinfo(3)], the [[BSD]] manual page. Whereas the man page code connects to <code>www.kame.net</code>, this code only prints the numeric addresses.
 
Line 720:
IPv6: 2001:200:dff:fff1:216:3eff:feb1:44d7</pre>
 
== {{header|Haskell}} ==
<lang haskell>module Main where
 
Line 787:
And, as mentioned above, the IPv6 DNS system was not reachable.
 
== {{header|Java}} ==
<lang java>import java.net.InetAddress;
import java.net.Inet4Address;
Line 816:
</pre>
 
== {{header|JavaScript}} ==
<lang JavaScript>const dns = require("dns");
 
Line 922:
203.178.141.194: orange.kame.net</pre>
 
== {{header|NetRexx}} ==
<lang netrexx>
/* NetRexx */
Line 944:
</pre>
 
== {{header|NewLISP}} ==
<lang newLISP>
 
Line 1,260:
Write-Host "IPv4:" $DNS.IP4Address "`nIPv6:" $DNS.IP6Address</lang>
 
== {{header|Python}} ==
<lang python>>>> import socket
>>> ips = set(i[4][0] for i in socket.getaddrinfo('www.kame.net', 80))
Line 1,388:
</pre>
 
== {{header|Ruby}} ==
<lang ruby>irb(main):001:0> require 'socket'
=> true
10,327

edits