Sign in to follow this  
pDK

gethostbyaddr failure on certain IPs

Recommended Posts

pDK    122
Hey guys, I recently moved my server application from my dev system (192.168.1.100) to another on my network (192.168.1.101). For temp purposes, I used a const varable as my server address. After the move, I updated the const to the correct ip (***.101), but this is failing on me. I tracked down the bug to this function:
LPHOSTENT	CWinsock::GetPTServerAddr()
{
	unsigned long addr;
	CCOMString servername;  //CCOMString - my NON-MFC CString :)

	servername = "192.168.1.101";

	addr = inet_addr(servername);
	return gethostbyaddr((char*)&addr,sizeof(unsigned long),AF_INET);
}
This function freezes on gethostbyaddr for about 20 secs and returns null when 'servername' is anything but "192.168.1.100" or "127.0.0.1"... Is this a system configuration error? If soo... anyway to error trap this? - Eric [edited for bad engrish]

Share this post


Link to post
Share on other sites
pDK    122
Here is my WSAGetError dump:
Winsock failed with error 11004: 
The requested name is valid and was found in the database,
but it does not have the correct associated data being resolved for.


[edited for sanity]

Share this post


Link to post
Share on other sites
pDK    122
Ohh boy... I'm sorry. I figured it out :).

My other system's cat-5 cable fell out...



Let's just leave it at that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this