ehm...

farlo è un casino...
cmq devi usare i socket UDP e poi devi leggerti l'rfc inerente ai DNS ^^