How do I write my own DNS lookup to list all sub domains on a host.
Because you see i want to write an smtp server, but as i've learned, after i send mail with my smtp server, it sends mail to the destination's smtp server. but how my smtp server finds the destination's smtp server's address?
So I did a little reasearch and I found out that it's done with dns lookup, but i could not find a manual on how to do that.
You need to lookup mx dns records. MX is short for Mail Exchange. These records point to the incoming smtp server for a domain.
Some operating systems have apis to lookup mx records. For example, DnsQuery is available on Windows 2000/XP. Alternatively you can use a library or just some code using sockets.
C code using sockets: