I have started working on the spam filtering in email for which i need to write a module which would query the DNS for blasklisted IP's. As a beginner can any please suggest me a good reading about DNS and making query to it using C++? . I searched around but wasn't able to get a very good source. Thanks in advance
As a beginner, you basically should know about one function, gethostbyname
.
Then if you want to check 8.8.4.4
against zen.spamhaus.org
, call
gethostbyname ("4.4.8.8.zen.spamhaus.org")
(note the reversed octets).
If this returns non-NULL, the IP is listed.
Now this is very primitive method with a number of drawbacks, but it works and you should try it before you move on to more sophisticated methods.