getaddrinfo、getnameinfo、gethostbyname、gethostbyaddr

概要

gethostbyname, gethostbyaddr是不可重入函数;已经被getaddrinfo, getnameinfo替代。

介绍

getaddrinfo
https://blog.csdn.net/mayue_web/article/details/98102013

getnameinfo
https://blog.csdn.net/mayue_web/article/details/98095392

gethostbyname
https://blog.csdn.net/mayue_web/article/details/98077372

gethostbyaddr
https://blog.csdn.net/mayue_web/article/details/98091737

DNS客户端异常如何解决?
http://m.sohu.com/a/153283172_748431

在使用getaddrinfo、getnameinfo、gethostbyname、gethostbyaddr之前调用res_init()刷新dns缓存;

#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
res_init(); 

其他:
https://blog.csdn.net/u011028408/article/details/84067040
https://blog.csdn.net/an_zhenwei/article/details/8591729

发布了60 篇原创文章 · 获赞 43 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/mayue_web/article/details/98106887
今日推荐