Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a non blocking method for host resolution in WINAPI?

There's getaddrinfo() for blocking host resolution, but is there a non blocking method?

like image 735
Plumenator Avatar asked Aug 09 '11 15:08

Plumenator


2 Answers

I don't think there is such a thing but you can always wrap it in a thread and use a semaphore to signal completion.

like image 164
cnicutar Avatar answered Sep 27 '22 20:09

cnicutar


Linux has getaddrinfo_a(). See the StackOverflow tag getaddrinfo-a, such as this question "How to use getaddrinfo_a to do async resolve with glibc". But I guess this isn't applicable for Windows.

There is a cross-platform library c-ares for asynchronous DNS requests, which says it runs on Windows. (I haven't tried it myself.)

like image 31
Craig McQueen Avatar answered Sep 27 '22 21:09

Craig McQueen