nicholso
asked on
DNS lookup from within VB 6.0
We have an app which talks SNMP with a remote host. At connect time the user has to enter an ip address (dotted quad). I'd like to let them enter the plaintext hostname and let our app do the name->address translation.
does anyone know of something that already exists in VB or winsock APIs to do this?
does anyone know of something that already exists in VB or winsock APIs to do this?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
thanks. Yeah it's way too much code for my purposes, but I was able to strip it down and works great.
thanks again.
thanks again.
And if you ever need it, you have the code to ping systems... One of the cooler functions in that code I gave you is "IsHostAlive". It returns a TRUE or a FALSE if the host passed on the argument can be connected to...
Thanks for the points! Glad I could help!
Cheers!®©
Thanks for the points! Glad I could help!
Cheers!®©
However, if you want do do *only* the DNS lookup without actually sending packets to the host in question, then you'll need to use the API directly. In that case, yell an I'll add a class module that does just that. Or, if you need more than just one IP to a name or vice versa, the control will not do, but my class will.
Oops, mcrider was quicker - his code seems good, too on a first glance, my only complaint'd be that CvtIPAddrClng could be substituted more elegantly by a function exported by the winsock DLL itself...