 |
|
 |
i have compiled the code but when i try to build it gives error can any one help me please ...
the error details are as follow
Linking...
dns.obj : error LNK2001: unresolved external symbol _inet_ntoa@4
dns.obj : error LNK2001: unresolved external symbol _gethostbyaddr@12
dns.obj : error LNK2001: unresolved external symbol _inet_addr@4
dns.obj : error LNK2001: unresolved external symbol _gethostbyname@4
dns.obj : error LNK2001: unresolved external symbol _gethostname@8
dns.obj : error LNK2001: unresolved external symbol _WSACleanup@0
dns.obj : error LNK2001: unresolved external symbol _WSAStartup@8
Debug/dns.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
dns.exe - 8 error(s), 0 warning(s)
|
|
|
|
 |
|
 |
The timeout for a host that doesn't exist is very long. nslookup.exe is much faster when a host doesn't exist. This is the exact issue I came up against when I was writing some similar code. Do you know how to get the resolution to be faster? Other then this issue good work!
Thanks,
Lu
|
|
|
|
 |
|
 |
Just the same if you try to PING a host that does not exist. It takes very long at first.
Try lowering the timeout if that is possible.
|
|
|
|
 |
|
 |
The compilation went ok, but when I try to build with visual C it gives 3 errors(2100 ,link errors).
Should I copy some file to some place
PLEASE DO HELP ME.....
|
|
|
|
 |
|
 |
This project requires the winsock libraries.
Link with the appropriate winsock .lib to compile it.
P.S. emailed you..
|
|
|
|
 |
|
 |
Hi!
Your program seems very good but im unable to compile it because i dont know what do you mean by "link with libwsock32.a when compiling", can you help me?
Thanks!
David Nunes
|
|
|
|
 |
|
 |
Just want to congratulate you on this piece of code.
Some info:
Using gethostbyname is better that gethostbyaddr as gethostbyname is apparently a little faster and does not bomb port 137. As discussed here, http://www.codeguru.com/Cpp/I-N/internet/network/article.php/c6239/
One question is what can be done with ip's that do not resolve to hosts and is this due to the DNS server not having an A record for the host, or reverse lookup not being configured?
|
|
|
|
 |
|
 |
Thanks for the info. I really appreciate it. =D
Actually, my code uses both. It will only use gethostbyname() if the parameters supplied is a hostname, and gethostbyaddress() if it's an ip address (because for now I don't know of any other way to implement a DNS query with an ip address w/o knowing the hostname).
JLèé
|
|
|
|
 |
|
 |
Hi,
I think that it is a good work that you have put up. You deserve a 5 from me.
Your implementation was what i was looking for.
I was searching for a similar thing. But i have query. I am developing a program where i need to know the address of the MX(mail exchange) of a domain. A similar result is yielded by using:
nslookup -type=mx yahoo.com
in DOS.
But the problem is that, since i am developing a windows app, the above command in a system() function, pops up a command window. This looks quite crude in my app. Can you please send a piece of code that can internally use the Winsock and give me the result. If not can you tell me the logic instead.
Thanx in advance.
Long live MFC!
//========\\
|| AslFunky ||
\\========//
Who said nothing is impossible, I have been doing it everyday
|
|
|
|
 |
|
 |
Try this sites:
http://www.2cah.com/dns/[^]
http://www.rscott.org/dns/mx.html[^]
or if you liked nslookup better, try writing your mx lookups in a file like: nslookup -type=mx yahoo.com > lookup.tmp ..... then open the file and get the needed info, but I'm not sure whether a DOS window will pop-up.
There is no need to get mx records on a domain if you are writing an e-mail server/client, since the SMTP server of the domain (e.g. yahoo.com) will search the mx records for you and redirect you to mail.yahoo.com.
Maybe if I have the time, I would make an email server and post it here next time.
JLèé
|
|
|
|
 |
|
 |
Thanx for the reply.
As, i said earlier, i have tried that output redirection with nslookup, but again that dos screen pops up.
Lets see what i can do.
Please do post a reply if you find any solution.
Thanx in advance.
Long live MFC!
//========\\
|| AslFunky ||
\\========//
Who said nothing is impossible, I have been doing it everyday
|
|
|
|
 |
|
 |
<< There is no need to get mx records on a domain since the SMTP server of the domain will search the mx records for you >>
What the SMTP server has to do with the MX lookup request?? The SMTP server of the receiving domain just expects a connection from outside from a given port (usually 25). If you intend to send a mail to yahoo.com, 3 cases:
- either you prepare a mail and provide it to "sendmail" for instance which does all the work
- or you use one of the API on your computer to send the mail (eg MAPI), and this API will resolve the MX entries and actually establish connection to one of the results (send mail)
- or, and I think this is the case here, you write your own API and bypass your local mail sender subsystem (eg MAPI) to send the mail, in this case you have to resolve the MX entries yourself then connect to one of the answers from the NS.
|
|
|
|
 |