gethostbyname2

您所在的位置:网站首页 gethostbyname2_r gethostbyname2

gethostbyname2

2024-07-12 07:12| 来源: 网络整理| 查看: 265

Linux Standard Base Core Specification, Generic Part>gethostbyname2_rNamegethostbyname2_r -- find network host database entry matching host name (DEPRECATED)Synopsis

int gethostbyname2_r(const char * restrict name, int af, struct hostent * restrict result_buf, char * restrict buf, size_t buflen, struct hostent ** restrict result, int * restrict h_errnop);

Description

Note: The gethostbyname2_r() function is deprecated; applications should use getaddrinfo() instead.

The gethostbyname2_r() function shall search the network host database for an entry with name name. gethostbyname2_r() is a reentrant version of gethostbyname2(). These functions are similar to the gethostbyname() and gethostbyname_r() functions but additionally allow the search to be restricted to a particular address family specified by af.

The application must provide a buffer for the gethostbyname2_r() function to use during the lookup process. The buffer is referenced by buf, and is of size buflen. If the buffer is not of sufficient size, gethostbyname_r() may fail and return ERANGE. If a matching entry is found in the database, gethostbyname_r() shall copy the relevant information to the application-supplied hostent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer. Additional error information shall be set in the variable referenced by h_errnop.

Return Value

On success, the gethostbyname2_r() function shall return zero. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small. If the gethostbyname2_r() function returns returns any other value, then the variable referenced by h_errnop shall be set to indicate the cause as for gethostbyname_r().

>gethostbyname2Upgethostbyname_r


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3