SYNOPSIS
#include <netdb.h>
extern int h_errno;
void
struct hostent *gethostbyaddr(const char *addr, size_t len, int type);
struct hostent *gethostbyname(const char *name);
struct hostent *gethostent(void);
void sethostent(int stayopen);
DESCRIPTION
The
- h_name
-
Official name of the host (PC).
- h_aliases
-
A null-terminated array of alternate names.
- h_addrtype
-
The type of address being returned.
- h_length
-
The length, in bytes, of each address.
- h_addr_list
-
A null-terminated list of addresses for the host. Addresses are returned in network byte order.
The
The
The
The
The
PARAMETERS
- addr
-
Points to the binary-format (that is, not null-terminated) address in network byte order. The data type of the address depends on the address family. For an address of type AF_INET, this is an in_addr structure.
- len
-
Is the length of the address in bytes.
- type
-
Is the type (address family) of the address.
- name
-
Is the host name or alias for the host whose address is to be returned.
- stayopen
-
When non-zero, the connection to the database is not closed after each call to
gethostent() .
RETURN VALUES
If successful,
- HOST_NOT_FOUND
-
No such host is known.
- NO_DATA
-
No data record found for the specified address.
- NO_RECOVERY
-
An unexpected server failure occurred; no recovery is possible.
- TRY_AGAIN
-
A temporary and possibly transient error occurred, such as the failure of a server to respond.
For some failures, they return a null pointer and set errno to one of the following values:
- EINTR
-
A signal interrupted the call.
- ENETDOWN
-
The network subsystem was down.
- EFAULT
-
addr is an invalid pointer.
The pointer that is returned points to a structure that is allocated by the NuTCRACKER Platform. 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; therefore, the application should copy any information it needs before issuing any other socket calls.
CONFORMANCE
UNIX 98, with exceptions.
MULTITHREAD SAFETY LEVEL
PORTING ISSUES
On 8.1/2012R2/10/2016/2019/11/2022, the hosts file is in the drivers/etc
directory under the 8.1/2012R2/10/2016/2019/11/2022 system directory.
The
Windows networking does not assign individual network names to physical
network interfaces.
Calling
The
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
_NutQueryWinNetFileDir() ,endnetent() ,endprotoent() ,endservent() ,getnetbyaddr() ,getnetbyname() ,getnetent() ,getprotobyname() ,getprotobynumber() ,getprotoent() ,getservbyname() ,getservbyport() ,getservent() ,htonl() ,inet_addr() ,inet_ntoa() ,ntohl() ,setnetent() ,setprotoent() ,setservent()
- Miscellaneous:
- h_errno
PTC MKS Toolkit 10.4 Documentation Build 39.