struct hostent {
char FAR * h_name;
char FAR * FAR * h_aliases;
short h_addrtype;
short h_length;
char FAR * FAR * h_addr_list;
};
h_name // Official name of the host (PC). If using the DNS or similar resolution system, it is the Fully Qualified
// Domain Name (FQDN) that caused the server to return a reply. If using a local hosts file, it is the
// first entry after the IP address.
//主机的正式名称,如果用的是DNS系统或者其他类似的域名解析系统,这就是域名全称,如果用的是
// local hosts 文件,那么这个就是 IP 地址后面的第一个名称
// [小知识:hosts 文件在 C:/WINDOWS/system32/drivers/etc 目录下]
h_aliases //Null-terminated array of alternate names.
//是 一个 char* 数组,是域名的别名,可以有多个
h_addrtype //Type of address being returned.
// 返回地址类型,通常是 AF_INET IPV4 或者 AF_INET6 IPV6
h_length // Length of each address, in bytes.
// 地址字节数,IPV4 是 4,IPV6 是 6
h_addr_list // Null-terminated list of addresses for the host.Addresses are returned in network byte order. The
// macro h_addr is defined to be h_addr_list[0] for compatibility with older software.
// 主机地址列表,该值是网络字节序,为了兼容老的版本 h_addr_list[0] = h_addr
hostent 结构体
最新推荐文章于 2024-03-01 10:15:38 发布
本文详细介绍了hostent结构体的各个字段含义及其在网络编程中的作用。包括主机名、别名列表、地址类型、地址长度及地址列表等关键信息。
1万+

被折叠的 条评论
为什么被折叠?



