Click here to Skip to main content
15,899,937 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A Question About Pin
Maer72722-Aug-01 20:08
Maer72722-Aug-01 20:08 
GeneralA Question About "SetModifiedFlag" Pin
Maer72721-Aug-01 22:24
Maer72721-Aug-01 22:24 
QuestionHow to toggled on the Numlock key on Windows 98? Pin
Maer72721-Aug-01 22:23
Maer72721-Aug-01 22:23 
GeneralA Simple Question About Compound File and structured storage Pin
Maer72721-Aug-01 22:22
Maer72721-Aug-01 22:22 
GeneralA Simple Question About ActiveX on Internet Pin
Maer72721-Aug-01 22:19
Maer72721-Aug-01 22:19 
GeneralRe: A Simple Question About ActiveX on Internet Pin
Derek Waters22-Aug-01 13:41
Derek Waters22-Aug-01 13:41 
GeneralRe: A Simple Question About ActiveX on Internet Pin
Maer72722-Aug-01 20:01
Maer72722-Aug-01 20:01 
QuestionHow to convert ip address to www address? Pin
Maer72721-Aug-01 22:17
Maer72721-Aug-01 22:17 
Here is my code for converting ip address to www address:
/////////////////////////////////
/////////code starts/////////////
/////////////////////////////////
WORD wVersionRequested;
WSADATA wsaData;
UpdateData(true);
wVersionRequested = MAKEWORD( 2, 2 );
WSAStartup( wVersionRequested, &wsaData );
unsigned long i;
hostent* address;
i=inet_addr(m_address);
address=gethostbyaddr((const char *)&i,4,AF_INET); if(address==NULL)
{
int j=WSAGetLastError();
CDialog::OnOK();
}
m_name=address->h_name;
UpdateData(false);
WSACleanup();
////////////////////////////////
//////////code ends/////////////
////////////////////////////////
Description:
m_address is a variable of the type CString; The function "UpdateData" get the input value of ip from a Control on a dialog. The variable "m_name" is to store the value of the www address.

But when I connect the "166.111.4.100"(www.tsinghua.edu.cn), an error occurs(from "WSAGetLastError()"). The error type is "WSANO_DATA", with the explanation "Valid name, no data record of requested type" in MSDN.

My question is:
Why the problem occurs? How can I correct it? Is there better methods to convert ip address to www address?

Thanks



AnswerRe: How to convert ip address to www address? Pin
markkuk22-Aug-01 1:08
markkuk22-Aug-01 1:08 
GeneralRe: How to convert ip address to www address? Pin
Maer72722-Aug-01 6:29
Maer72722-Aug-01 6:29 
GeneralRe: How to convert ip address to www address? Pin
markkuk22-Aug-01 20:55
markkuk22-Aug-01 20:55 
GeneralRe: How to convert ip address to www address? Pin
Maer72723-Aug-01 4:47
Maer72723-Aug-01 4:47 
GeneralRe: How to convert ip address to www address? Pin
markkuk23-Aug-01 21:03
markkuk23-Aug-01 21:03 
GeneralRe: How to convert ip address to www address? Pin
Maer72724-Aug-01 3:08
Maer72724-Aug-01 3:08 
GeneralRecieve commands from CEdit popup menu Pin
21-Aug-01 20:59
suss21-Aug-01 20:59 
GeneralRe: Recieve commands from CEdit popup menu Pin
Tomasz Sowinski22-Aug-01 0:17
Tomasz Sowinski22-Aug-01 0:17 
GeneralNumeric type conversion Pin
Jimmy Ehrnström21-Aug-01 20:39
Jimmy Ehrnström21-Aug-01 20:39 
GeneralRe: Numeric type conversion Pin
22-Aug-01 7:31
suss22-Aug-01 7:31 
QuestionHow "Window" menu works Pin
21-Aug-01 19:34
suss21-Aug-01 19:34 
AnswerRe: How Pin
Tomasz Sowinski21-Aug-01 23:40
Tomasz Sowinski21-Aug-01 23:40 
GeneralCustom buttons in title bar Pin
marutis21-Aug-01 19:27
marutis21-Aug-01 19:27 
GeneralRe: Custom buttons in title bar Pin
Tommy H D Svensson22-Aug-01 0:53
Tommy H D Svensson22-Aug-01 0:53 
QuestionCComboBox resize list part of control??? Pin
21-Aug-01 19:20
suss21-Aug-01 19:20 
AnswerRe: CComboBox resize list part of control??? Pin
Andreas Saurwein22-Aug-01 13:32
Andreas Saurwein22-Aug-01 13:32 
QuestionWindows' program porting to Macintosh? Pin
hardhorse21-Aug-01 18:39
hardhorse21-Aug-01 18:39 

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.