Does Win32 getaddrinfo() use C:\Windows\System32\drivers\etc\hosts?
We want to use C:\Windows\System32\drivers\etc\hosts to specify IPv6-only addresses (which are NOT part of the DNS), and let our Win32 console application use it via getaddrinfo(), but it does not find it.
Why? Is there maybe an API which uses C:\Windows\System32\drivers\etc\hosts AND DNS?
No.
C:\Windows\System32\drivers\etc\hosts is a DNS file, which can be opened directly with Notepad and redirects the IP address.
The format is: IP address - space - domain name
It can redirect a domain name to an IP.
Does Win32 getaddrinfo() use C:\Windows\System32\drivers\etc\hosts?
The getaddrinfo function provides protocol-independent translation from an ANSI host name to an address.
If you want to specify IPv6-only addresses, you can see my answer How to display current IPv6 connections?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With