hi, i am using dnsquery api function to query the mx record, what it seems to me as blocking my application. Is there any alternative or solution.
Printable View
hi, i am using dnsquery api function to query the mx record, what it seems to me as blocking my application. Is there any alternative or solution.
I did just look through the DNS API and I couldn't see any support for asynchronous calls or setting a timeout.
I would start thread and call it from the thread. Then you can implement your own timeout by using WaitForSingleObject on the thread handle (from the calling thread).
Can you provide some sample code please how timeout can be implemented as after a particular period i have to kill the thread assuming that my DNS query failed.
I can't use terminate thread as it may induce resource leakage. And as call to api is blocking, how can i use WaitForSingleObject, please elaborate a bit.
Sure, download attached ZIP file.
Hmm... There is a small design error in the attached code in my previous post. I don't know if this error will show up (it never did for me), but the correction is to let the thread release parameters upon timeout. This is of course a bit tricky, becuase the thead must then know about the timeout (that it happened).