Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否有一种方法可以在 Windows 和 Linux 中以编程方式清除单个 DNS 缓存条目。或者,如果有其他方法可以强制 gethostbyname 调用不使用本地缓存。
清除整个缓存并不理想。
谢谢。
我隐约记得在设置了 AUTHORITATIVE 位的情况下向缓存发出请求。
你不能用 gethostbyname() 做到这一点:你必须在 UDP 端口 53 上调用解析器。