Click here to Skip to main content
15,907,326 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multi-threaded graphics Pin
Iceman16-Apr-03 2:50
Iceman16-Apr-03 2:50 
GeneralRe: Multi-threaded graphics Pin
Iceman16-Apr-03 2:57
Iceman16-Apr-03 2:57 
GeneralWeird run-time error Pin
will138315-Apr-03 10:25
will138315-Apr-03 10:25 
GeneralRe: Weird run-time error Pin
Chris Losinger15-Apr-03 10:35
professionalChris Losinger15-Apr-03 10:35 
GeneralRe: Weird run-time error Pin
will138315-Apr-03 10:38
will138315-Apr-03 10:38 
GeneralRe: Weird run-time error Pin
Joe Woodbury15-Apr-03 14:00
professionalJoe Woodbury15-Apr-03 14:00 
GeneralRe: Weird run-time error Pin
Beer15-Apr-03 13:21
Beer15-Apr-03 13:21 
Generalgethostbyaddr problem Pin
Tom Wright15-Apr-03 10:20
Tom Wright15-Apr-03 10:20 
I'm writing a program that gets a computer name from a list of IP address. The first time thru it gets the computer name without a hitch. From then on I keep getting a error.
Here is a snippet of my code that does the gethostbyaddr.
}<br />
	LPHOSTENT lphp;<br />
	struct in_addr in_addrIP;<br />
<br />
	//char szBuffName[80];<br />
<br />
	<br />
	if (!InitSocket()) <br />
	{<br />
		AfxMessageBox("Error initializing WSAStartup", MB_OK | MB_ICONSTOP);<br />
		return -1;<br />
	}<br />
	<br />
	in_addrIP.S_un.S_addr = inet_addr(szAddress);<br />
	lphp = gethostbyaddr((char FAR *)&in_addrIP, sizeof(struct in_addr), PF_INET);<br />
<br />
	if (lphp == NULL)<br />
	{<br />
		AfxMessageBox("Failed at gethostbyaddr", MB_OK | MB_ICONSTOP);<br />
		return -1;<br />
	}<br />
	<br />
	WSACleanup();<br />
<br />
	return lphp->h_name;<br />
<br />
	//return 1;<br />
<br />
}

Am I supposed to initialize something before I give it another address to try?

Thanks


Tom Wright
tawright915@yahoo.com
GeneralRe: gethostbyaddr problem Pin
valikac15-Apr-03 11:09
valikac15-Apr-03 11:09 
GeneralRe: gethostbyaddr problem Pin
Tom Wright15-Apr-03 11:12
Tom Wright15-Apr-03 11:12 
GeneralRe: gethostbyaddr problem Pin
David Crow16-Apr-03 2:24
David Crow16-Apr-03 2:24 
GeneralRe: gethostbyaddr problem Pin
Tom Wright16-Apr-03 3:42
Tom Wright16-Apr-03 3:42 
GeneralRe: gethostbyaddr problem Pin
David Crow16-Apr-03 3:53
David Crow16-Apr-03 3:53 
GeneralRe: gethostbyaddr problem Pin
Tom Wright16-Apr-03 4:42
Tom Wright16-Apr-03 4:42 
GeneralRe: gethostbyaddr problem Pin
Tom Wright16-Apr-03 5:05
Tom Wright16-Apr-03 5:05 
GeneralFile Comparisons Pin
Colin Davidson15-Apr-03 10:06
Colin Davidson15-Apr-03 10:06 
GeneralRe: File Comparisons Pin
Joe Woodbury15-Apr-03 14:02
professionalJoe Woodbury15-Apr-03 14:02 
GeneralEdit Ctrl Style(ES_CENTER) Pin
Mr. Maan15-Apr-03 9:53
Mr. Maan15-Apr-03 9:53 
GeneralRe: Edit Ctrl Style(ES_CENTER) Pin
Miszou15-Apr-03 10:54
Miszou15-Apr-03 10:54 
GeneralRe: Edit Ctrl Style(ES_CENTER) Pin
Mr. Maan15-Apr-03 11:14
Mr. Maan15-Apr-03 11:14 
GeneralRe: Edit Ctrl Style(ES_CENTER) Pin
Gary R. Wheeler18-Apr-03 5:35
Gary R. Wheeler18-Apr-03 5:35 
Generalstring, map STL problem Pin
Matthew Fleming15-Apr-03 8:55
Matthew Fleming15-Apr-03 8:55 
GeneralRe: string, map STL problem Pin
Ben Burnett15-Apr-03 9:18
Ben Burnett15-Apr-03 9:18 
GeneralRe: string, map STL problem Pin
jhwurmbach15-Apr-03 21:38
jhwurmbach15-Apr-03 21:38 
GeneralRe: string, map STL problem Pin
richard_k1-Jun-10 15:19
richard_k1-Jun-10 15:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.