The client library must be threadable . Thread creation is generally faster than process creation. Event handling with poll or select . The client library must be asynchronous . Event handling is generally the fastest solution, but puts the most stringent requirements on the client library.
Asynchronous libraries are automatically threadable.
There is a sample dnsfilter program that shows how to do many PTR lookups in parallel. The buffer is inevitably much too large for typical results, wasting memory, and too small for large results, making lookups fail on occasion. In contrast, the dns functions dynamically allocate the right amount of space for incoming DNS packets and for final results.