Is there a locking method for resolving a host in WINAPI?

There getaddrinfo() for blocking host permissions, but is there a blocking method?

+7
source share
4 answers

I don’t think there is such a thing, but you can always wrap it in a stream and use a semaphore to complete the signal.

+2
source

Linux has getaddrinfo_a() . See the StackOverflow getaddrinfo-a tag, for example this question "How to use getaddrinfo_a to solve async using glibc" . But I assume this is not applicable for Windows.

There is a cross-platform c-ares library for asynchronous DNS queries that says it works on Windows. (I have not tried it myself.)

+3
source

On the MSDN page in GetAddrInfoEx, the OVERLAPPED parameter reports

"On Windows 7 and Windows Server 2008 R2 or earlier, this parameter is currently reserved and must be set to NULL because asynchronous operations are not supported."

This means that you can only use the OVERLAPPED function in Windows 8 and later. If Steve cannot show that he works in the old version of windows ...

+2
source

On Windows Vista and Windows Server 2008, you can use GetAddrInfoEx with OVERLAPPED .

Once the hEvent event is set in the OVERLAPPED structure, use GetAddrInfoExOverlappedResult .

0
source

All Articles