I'm trying to implement dns service discovery in my application (no, I'm not asking for a programmatic answer). What I believe is one of my big pain points is generating the query. I know I need to send out a multicast broadcast on port 5353 and want to look for devices of type _ipp._tcp and _print._tcp, but I don't know what the question section needs to look like.

For example, in SSDP I sent out a query that looks like the following:

"M-SEARCH * HTTP/1.1\r\n"
"HOST:\r\n" +
"MAN: \"ssdp:discover\"\r\n"
"ST: urn:schemas-upnp-org:device:Printer:1\r\n"
"MX: 5000\r\n\r\n"

From what I know about a DNS query I need to send something like:


but I know there needs to be more.

Any pointers to documentation, etc would be greatly appreciated!

update rfc1035 appears to contain promising information re the message structure.


Between rfc1035 and wireshark, I have a pretty decent picture of what a query looks like. For a standard query, basically the Answer/Authority/Additional fields will be blank. The header contains general information including how many Question sections are included.

|        Header       |
|       Question      | the question for the name server
|        Answer       | RRs answering the question
|      Authority      | RRs pointing toward an authority
|      Additional     | RRs holding additional information

Wireshark even gives you the bits and hex view of the DNS query. It's a pretty cool tool that I wish I knew about sooner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.