Building DNS query tool from scratch using C