Jump to content
  • Advertisement


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


gethostbyname problem

This topic is 5896 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

I have this code:
HOSTENT *host;
char name[100]="mail.gmx.net";
		aValue=*((DWORD *)(*host->h_addr_list));
	else aValue=inet_addr(name);
//The address is good to use with a socket

but it doesn''t work the address is invalid And do I need to be connected to the network what''s the problem Mankind must put an end to war before war puts an end to mankind. John F. Kennedy

Share this post

Link to post
Share on other sites
make sure you have called wsastartup and you have recieved a WSADATA structure

you can specify the version with MAKEWORD(2,2)


Genetics 3rd Dimension Development

Share this post

Link to post
Share on other sites
You really should be calling inet_addr first. The point is to avoid having to go out to the net to lookup a name that doesn''t need looking up.

Yes, you need to be connected to a network for gethostbyname to work. You need to have access to some sort of DNS server.

What, exactly, is it that doesn''t work, and what error code do you get? What is invalid, the name you''re putting in or the result you''re getting back? You really haven''t supplied the basic info about your problem.

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!