Description
Get host information corresponding to an address.
#include <winsock.h>
struct hostent FAR * PASCAL FAR gethostbyaddr ( const char FAR * addr, int len, int type );
addr
Remarks
gethostbyaddr() returns a pointer to the following structure which contains the name(s) and address which correspond to the given address.
struct hostent { char FAR * h_name; char FAR * FAR *h_aliases; short h_addrtype; short h_length; char FAR * FAR *h_addr_list; };
The members of this structure are:
h_name
The macro h_addr is defined to be h_addr_listφ0∙ for compatibility with older software.
The pointer which is returned points to a structure which is allocated by the Windows Sockets implementation. 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, and so the application should copy any information which it needs before issuing any other Windows Sockets API calls.
Return Value
If no error occurs, gethostbyaddr() returns a pointer to the hostent structure described above. Otherwise it returns a NULL pointer and a specific error number may be retrieved by calling WSAGetLastError()
Error Codes
WSANOTINITIALISED
See Also
WSAAsyncGetHostByAddr(), gethostbyname(),