Click here to Skip to main content
15,915,094 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Data Type from Serial Port Pin
CNewbie4-Apr-04 13:50
CNewbie4-Apr-04 13:50 
General_ATL_CSTRING_EXPLICIT_CONSTRUCTORS question Pin
J.B.3-Apr-04 12:37
J.B.3-Apr-04 12:37 
GeneralMFC Dialog Choices Pin
Anonymous3-Apr-04 12:20
Anonymous3-Apr-04 12:20 
GeneralRe: MFC Dialog Choices Pin
bneacetp3-Apr-04 19:08
bneacetp3-Apr-04 19:08 
GeneralRe: MFC Dialog Choices Pin
Ravi Bhavnani3-Apr-04 21:29
professionalRavi Bhavnani3-Apr-04 21:29 
Generaldsn to ip in c++ Pin
Irish_GUI3-Apr-04 11:50
Irish_GUI3-Apr-04 11:50 
GeneralRe: dsn to ip in c++ Pin
Orkun GEDiK3-Apr-04 12:08
Orkun GEDiK3-Apr-04 12:08 
GeneralRe: dsn to ip in c++ Pin
avenger_sb255-Apr-04 5:48
avenger_sb255-Apr-04 5:48 
This function is the one you r looking for---->

gethostbyname
The Windows Sockets gethostbyname function retrieves host information corresponding to a host name from a host database.

struct hostent FAR *gethostbyname(
const char FAR *name
);
Parameters
name
[out] Pointer to the null-terminated name of the host to resolve.
Return Values
If no error occurs, gethostbyname returns a pointer to the HOSTENT structure described above. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError.

Error code Meaning
WSANOTINITIALISED A successful WSAStartup call must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSAHOST_NOT_FOUND Authoritative answer host not found.
WSATRY_AGAIN Nonauthoritative host not found, or server failure.
WSANO_RECOVERY A nonrecoverable error occurred.
WSANO_DATA Valid name, no data record of requested type.
WSAEINPROGRESS A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAEFAULT The name parameter is not a valid part of the user address space.
WSAEINTR A blocking Windows Socket 1.1 call was canceled through WSACancelBlockingCall.


Remarks
The gethostbyname function returns a pointer to a HOSTENT structure—a structure allocated by Windows Sockets. The HOSTENT structure contains the results of a successful search for the host specified in the name parameter.

The application must never attempt to modify this structure or to free any of its components. Furthermore, only one copy of this structure is allocated per thread, so the application should copy any information it needs before issuing any other Windows Sockets function calls.

The gethostbyname function cannot resolve IP address strings passed to it. Such a request is treated exactly as if an unknown host name were passed. Use inet_addr to convert an IP address string the string to an actual IP address, then use another function, gethostbyaddr, to obtain the contents of the HOSTENT structure.

The gethostbyname function resolves the string returned by a successful call to gethostname.

Requirements
Version: Requires Windows Sockets 1.1 or later.
Header: Declared in Winsock2.h.
Library: Use Ws2_32.lib.



Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
Generalparallel port programming Pin
Member 9936933-Apr-04 10:34
Member 9936933-Apr-04 10:34 
GeneralRe: parallel port programming Pin
Abbas_Riazi3-Apr-04 23:51
professionalAbbas_Riazi3-Apr-04 23:51 
GeneralCreating a binary file Pin
Ista3-Apr-04 9:05
Ista3-Apr-04 9:05 
GeneralRe: Creating a binary file Pin
ohadp3-Apr-04 21:01
ohadp3-Apr-04 21:01 
GeneralRe: Creating a binary file Pin
Ista4-Apr-04 15:36
Ista4-Apr-04 15:36 
QuestionHow to verify: IsCDRomDoorOpend Pin
adynis3-Apr-04 7:16
adynis3-Apr-04 7:16 
AnswerRe: How to verify: IsCDRomDoorOpend Pin
Alexander M.,4-Apr-04 1:05
Alexander M.,4-Apr-04 1:05 
GeneralRe: How to verify: IsCDRomDoorOpend Pin
adynis4-Apr-04 1:18
adynis4-Apr-04 1:18 
GeneralText to speech program Pin
sschilachi3-Apr-04 7:03
sschilachi3-Apr-04 7:03 
GeneralRe: Text to speech program Pin
John M. Drescher3-Apr-04 9:31
John M. Drescher3-Apr-04 9:31 
GeneralRe: Text to speech program Pin
Ravi Bhavnani3-Apr-04 10:46
professionalRavi Bhavnani3-Apr-04 10:46 
GeneralRe: Text to speech program Pin
(Steven Hicks)n+14-Apr-04 16:54
(Steven Hicks)n+14-Apr-04 16:54 
Generalmystery black screen Pin
timjimin3-Apr-04 6:32
timjimin3-Apr-04 6:32 
GeneralRe: mystery black screen Pin
John R. Shaw3-Apr-04 15:08
John R. Shaw3-Apr-04 15:08 
GeneralInvitation Pin
Member 7951483-Apr-04 6:21
Member 7951483-Apr-04 6:21 
GeneralcFormView controls - font, size, etc. Pin
snoopy3693-Apr-04 5:36
snoopy3693-Apr-04 5:36 
GeneralRe: cFormView controls - font, size, etc. Pin
Michael P Butler3-Apr-04 8:11
Michael P Butler3-Apr-04 8:11 

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.