How to use getaddrinfo

  • Thread starter Thread starter Itay
  • Start date Start date
I

Itay

I am trying to use getaddrinfo in order to resolve the IP address of a host
( lets say www.microsoft.com) and I keep getting errors.
All I need is To give (getaddrinfo )a host name and to recive the IP
address.

Thanks Itay
 
Hi Itay. Thank-you for your post.

That API requires Windows XP or Windows Server 2003 on the client. Are you
developing this app for these specific OSes? If not, you might want to use
gethostbyname or the DnsQuery API (Windows 2000 and later).

MSDN has some sample code that should help:
getaddrinfo:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/win
sock/getaddrinfo_2.asp

Other options:
gethostbyname:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/win
sock/gethostbyname_2.asp

dnsquery:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dns/dns/dns
query.asp

I hope that helps.

Tim Rains
Product Support Services
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top