That's quite a project you've picked up for yourself, especially considering the fact that you indicate you have no real knowledge about how DNS actually works. (Don't worry about that, neither do I ) Can you tell us why you don't want to use an existing library?
Anyway, the first step would be to research how the DNS protocol works. I've checked this briefly but it only mentions that UDP is used. Perhaps you can find more information from the references at the bottom of that page.
And could you please UseCodeTags next time? It makes code easier to read.
Thank you for the answer. I want to do this because I have to . It is an assigment at the University.
And sorry for the CodeTags. Anyway if i figure out i post it maybe help someone someday.
There is so little information about this on the net
I know even less about DNS than Rob does (apparently we both know what it is, but that's all). So I chose "dns protocol" as my google keywords and soon found a few documents which look like they might be what you need. Here's one of them: DNS Protocol; in addition there seem to be other more basic documents in the same set of pages.