getaddrinfo failed gethostbyname函数已经过时,怎么由getaddrinfo替换?

gethostbyname函数已经过时,怎么由getaddrinfo替换?在使用gethostbyname之前非常简单,类似于这样:structhost*remotehoststructinuuadd

gethostbyname函数已经过时,怎么由getaddrinfo替换?

在使用gethostbyname之前非常简单,类似于这样:

structhost*remotehost

structinuuaddraddr

if((remotehost=gethostbyname(hostname))==NULL){

xxxx

}

else{

if(remotehost->huaddrtype==AFuinet)

{

while(remotehost->huaddrulist[i]!=0){

addr.suaddr=*(uulong*)remoteHost->huaddrulist[i

]printf(“tIPAddress35;%d:%sn”,i,inetuntoa(addr))

Error: getaddrinfo ENOTFOUND?

错误:getaddrinfo enotfound错误是由于系统引起的,解决步骤如下:1配置.js配置文件,