I'll dig up my old comment about how easy DNS is to work with using DNS4J: Message query = new Message(data); Header header = query.getHeader(); Record question = query.getQuestion(); Message response = new Message(query.getHeader().getID()); response.getHeader().setFlag(Flags.QR); response.addRecord(question, Section.QUESTION); Name name = question.getName(); int type = question.getType(); int dclass = question.getD…
On one hand, like all Java code, this is really really verbose. But on the other, it's not that complicated—every line seems like it corresponds to some part of the DNS spec.