Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

gethostbyaddr (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This function retrieves the host information corresponding to a network address.

Note   The gethostbyaddr function has been deprecated by the introduction of the getnameinfo function. Developers who create Windows Sockets 2 applications are urged to use the getnameinfo function instead of the gethostbyaddr function. See Remarks.
struct hostent FAR* gethostbyaddr(
  const char FAR* addr,
  int len,
  int type
);

Parameters

addr
[in] Pointer to an address in network byte order.
len
[in] Length of the address.
type
[in] Type of the address, such as the AF_INET address family type (defined as TCP, UDP, and other associated Internet protocols). Address family types and their corresponding values are defined in the winsock2.h header file.

Return Values

If no error occurs, this function returns a pointer to the hostent structure that contains the name and address corresponding to the given network address. If an error occurs, it returns a NULL pointer, and a specific error code can be retrieved by calling WSAGetLastError.

The following table shows a list of possible error codes.

Error codeDescription
WSANOTINITIALISED A successful WSAStartup call must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSAHOST_NOT_FOUND An authoritative answer host was not found.
WSATRY_AGAIN A nonauthoritative host was not found, or the server failed.
WSANO_RECOVERY A nonrecoverable error occurred.
WSANO_DATA A valid name exists, but no data record of the requested type exists.
WSAEINPROGRESS A blocking Winsock call is in progress, or the service provider is still processing a callback function.
WSAEAFNOSUPPORT The type specified is not supported by the Windows Sockets implementation.
WSAEFAULT The addr parameter is not a valid part of the user address space, or the len parameter is too small.
WSAEINTR The socket was closed.

Remarks

Although gethostbyaddr is deprecated by the getnameinfo function, gethostbyaddr is capable of returning a NetBIOS name; getnameinfo is not. Developers who require NetBIOS name resolution may need to use gethostbyaddr until their applications are completely independent of NetBIOS names.

Note   The capability to perform reverse lookups by using the gethostbyaddr function is convenient, but such lookups are considered inherently unreliable, and should be used only as a hint.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winsock2.h.
Link Library: Ws2.lib.

See Also

gethostbyname | hostent | WSAGetLastError | WSAStartup


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show:
© 2015 Microsoft