Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

zackriggle

Resolving IP Addresses

This topic is 5712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
No, inet_addr() will only translate a dotted ip address. If the string you pass it isn't a valid ip address then it will return INADDR_NONE. You should check for this value, and then use gethostbyname or (if you're using asyncronous sockets anyway) WSAAsyncGetHostByName to resolve the name using DNS.

Information about all the functions can be found in the winsock documentation or on msdn (msdn.microsoft.com).

Winsock API documentation is here.
WSAAsyncGetHostByName is here.
inet_addr is here.

EDIT:
For general winsock information, I suggest you look at the winsock FAQ.

Hope that helps,

John B

[edited by - JohnBSmall on April 19, 2003 11:37:36 AM]

Share this post


Link to post
Share on other sites
I know the gethostbyname SHOULD work, but it does not seem to. The ones I am trying to get it to work for is:

xtac.kicks-ass.net
or
xtac.serveftp.net
or
mqonline.homeftp.net

They all point to the same IP address. Ping them, and it works just fine, but I cannot do much else. I do not want to use WSAAsync* functions right now, because I am just doing stuff with the console.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!