Click here to Skip to main content
11,410,379 members (56,610 online)
Click here to Skip to main content

DNS if u need it

, 1 Oct 2002
Rate this:
Please Sign up or sign in to vote.
Simple quering DNS servers for retrieve information about host's DNS records
<!-- Download Links --> <!-- Add the rest of your HTML here -->


Some times you want to receive information from DNS servers using C++. This simple project shows how you can send and receive messages to and from DNS servers.

There are 2 downloads supplied (see above)
The first download contains the DNS structures and CDnsResolver class that you can use to make queries of your own.
The second download contains a sample project, console application.
Use sample app:
usingdns.exe DNS server mail_host mail_host [any count hosts]

For advanced users I'm add new demo project
This showing as interpret DNS answers (gethostbyname() too Wink | ;)

This cool for Mail servers or just for study how it works.

For more inforamtion read the RFC documentation at DNS.NET [^] which also contains a number of useful tools.

If you know how to return this information under plain Win32 please post a message below.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Russian Federation Russian Federation
Programmer with 5 year of work
like networking applications and fun codes

Comments and Discussions

GeneralBon! Pinmemberalexiworld16-May-04 2:48 
QuestionWhy atre there so many compiler warnings? Pinmemberhesterloli8-Jan-04 18:33 
AnswerRe: Why atre there so many compiler warnings? PinmemberDarkSn0w9-Jan-04 0:51 
GeneralRe: Why atre there so many compiler warnings? Pinmemberhesterloli9-Jan-04 5:53 
GeneralRe: Why atre there so many compiler warnings? PinmemberDarkSn0w10-Jan-04 6:09 
GeneralGREAT CODE!!!!! PinsussBarçaBoy6-Nov-03 9:45 
GeneralRe: GREAT CODE!!!!! PinmemberDarkSn0w6-Nov-03 20:44 
GeneralRe: GREAT CODE!!!!! PinsussAnonymous25-Dec-03 8:02 
GeneralRe: GREAT CODE!!!!! PinmemberDarkSn0w9-Jan-04 0:57 
GeneralRe: GREAT CODE!!!!! Pinsussd-code3-Dec-04 11:14 
GeneralGREAT CODE!!!!! PinmemberBarçaBoy6-Nov-03 9:45 
Generalthanks Pinmembernjuhuangchinesemy6-Oct-03 23:02 
Generalgethostbyaddr Pinmembermycia30-Mar-03 18:51 
GeneralRe: gethostbyaddr PinmemberDarkSn0w22-Apr-03 4:34 
GeneralThanx... PinmemberEPulse22-Feb-03 2:12 
GeneralRe: Thanx... PinmemberDarkSn0w22-Apr-03 4:29 
GeneralDNSQuery() PinmemberAndreas Saurwein6-Feb-03 7:07 
GeneralRe: DNSQuery() PinmemberDarkSn0w22-Apr-03 4:26 
GeneralDon't use this source Pinmemberwukas6-Feb-03 6:41 
GeneralRe: Don't use this source PinmemberDarkSn0w22-Apr-03 4:25 
GeneralRe: Don't use this source PinmemberDarkSn0w6-Nov-03 20:37 
i'm know what this code has many errors..
but there was for testing of DNS quering and this belove that DNS answer has no any errors. If DNS answer is not corrent. this may fail. I have correct code for commercial application, but for beginners and this very good. Sorry for this errors. Smile | :)
GeneralRe: Don't use this source Pinmember_BenC_22-Oct-04 2:35 
GeneralRe: Don't use this source PinmemberTuPacMansur5-Sep-05 20:32 
Questiongethostbyname() ?? PinsussAnonymous30-Sep-02 8:06 
AnswerRe: gethostbyname() ?? PinmemberDarkSn0w1-Oct-02 19:12 
GeneralRe: gethostbyname() ?? PinsussAnonymous3-Oct-02 7:45 
GeneralWin32 PinmemberShaun Wilde29-Sep-02 9:18 
GeneralRe: Win32 PinmemberDarkSn0w30-Sep-02 4:31 
GeneralRe: Win32 PinmemberShaun Wilde30-Sep-02 5:02 
GeneralAnd in English... PinmemberShaun Wilde29-Sep-02 8:54 
GeneralRe: And in English... PinmemberGeorge29-Sep-02 16:36 
GeneralRe: And in English... PinmemberShaun Wilde29-Sep-02 23:59 
GeneralRe: And in English... PinmemberDarkSn0w30-Sep-02 4:28 
GeneralRe: And in English... PinmemberShaun Wilde30-Sep-02 5:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150414.5 | Last Updated 2 Oct 2002
Article Copyright 2002 by DarkSn0w
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid