int net_is_validipv6(const char *hostname)
{
struct sockaddr_in6 addr;
if (!hostname) return -1;
if (strchr(hostname, '.')) return -1;//暂时排除::ffff:204.152.189.116
if (inet_pton(AF_INET6, hostname, &addr.sin6_addr) != 1) return -1;
return 0;
}
c语言判断格式是否IPv6
猜你喜欢
转载自blog.csdn.net/y7u8t6/article/details/83374060
今日推荐
周排行