用getaddrinfo试试看吧
gethostbyname已经不建议使用了,而且它可能只能解析主机名而不是域名。
文档里有这么一句:
The gethostbyname function resolves the string returned by a successful call to gethostname.
引用 5 楼 ruritanian 的回复:
用getaddrinfo试试看吧
gethostbyname已经不建议使用了,而且它可能只能解析主机名而不是域名。
文档里有这么一句:
The gethostbyname function resolves the string returned by a successful call to gethostname.