Closed fukamachi closed 3 years ago
Unfortunately, this will not work if address is IPv6 only. In this case vector quiad will give wrong results:
PLAYGROUND> (usocket:get-host-by-name "ipv6.test-ipv6.com")
#(32 1 4 112 0 1 0 24 0 0 0 0 0 0 1 21)
PLAYGROUND> (usocket:vector-quad-to-dotted-quad *)
"32.1.4.112"
It should be resolved to IPv6:
[art@art-osx:~]% host ipv6.test-ipv6.com
ipv6.test-ipv6.com has IPv6 address 2001:470:1:18::115
Probably, you need to call either vector-quad-to-dotted-quad
or vector-to-ipv6-host
depending on vector length:
PLAYGROUND> (usocket:vector-to-ipv6-host **)
"2001:470:1:18::115"
Oh, I found a solution inside the usocket
:
CL-USER> (usocket:get-host-by-name "ipv6.test-ipv6.com")
#(32 1 4 112 0 1 0 24 0 0 0 0 0 0 1 21)
CL-USER> (usocket:host-to-hostname *)
"2001:470:1:18::115"
"localhost" won't be accepted by some web servers like wookie. This adds usocket as a dependency.