getaddrinfo-a

gai_cancel() takes a really long time to succeed

血红的双手。 提交于 2021-02-10 13:46:12
问题 I am trying to look up domain asynchronously in c++. The reason is I want to be able to effectively add a time out period in case the system can't look up the domain. I came across the getaddrinfo_a() command so I decided to give it a try. However cancelling any dns look up that will not succeed (such as when there is no internet connection) will never take less than 20 seconds on my machine. Here is a simple example of this: #include <iostream> #include <netdb.h> #include <string.h> #include

Slow response from getaddrinfo

帅比萌擦擦* 提交于 2019-12-05 18:24:49
问题 I'm using getaddrinfo to do DNS queries from C++ on Windows. I used to use the Windows API DnsQuery and that worked fine, but when adding IPv6 support to my software I switched to getaddrinfo. Since then, I've seen the following: My problem is that some times getaddrinfo take very long time to complete. The typical response from getaddrinfo takes just a few milliseconds, but roughly 1 time out of 10000, it takes longer time, in some cases around 15 seconds but there's been several cases when

Slow response from getaddrinfo

☆樱花仙子☆ 提交于 2019-12-04 02:49:32
I'm using getaddrinfo to do DNS queries from C++ on Windows. I used to use the Windows API DnsQuery and that worked fine, but when adding IPv6 support to my software I switched to getaddrinfo. Since then, I've seen the following: My problem is that some times getaddrinfo take very long time to complete. The typical response from getaddrinfo takes just a few milliseconds, but roughly 1 time out of 10000, it takes longer time, in some cases around 15 seconds but there's been several cases when it takes several minutes. I've run Wireshark on the server and analyzed my applications debug logs and

How to use getaddrinfo_a to do async resolve with glibc

拜拜、爱过 提交于 2019-12-03 07:09:52
问题 An often overlooked function that requires no external library, but basically has no documentation whatsoever. 回答1: UPDATE (2010-10-11) : The linux man-pages now have documentation of the getaddrinfo_a, you can find it here: http://www.kernel.org/doc/man-pages/online/pages/man3/getaddrinfo_a.3.html As a disclaimer I should add that I'm quite new to C but not exactly a newbie, so there might be bugs, or bad coding practices, please do correct me (and my grammar sucks too). I personally didn't

How to use getaddrinfo_a to do async resolve with glibc

廉价感情. 提交于 2019-12-02 20:43:42
An often overlooked function that requires no external library, but basically has no documentation whatsoever. UPDATE (2010-10-11) : The linux man-pages now have documentation of the getaddrinfo_a, you can find it here: http://www.kernel.org/doc/man-pages/online/pages/man3/getaddrinfo_a.3.html As a disclaimer I should add that I'm quite new to C but not exactly a newbie, so there might be bugs, or bad coding practices, please do correct me (and my grammar sucks too). I personally didn't know about it until I came upon this post by Adam Langley, I shall give a few code snippets to illustrate