winsock 通过域名获取ip地址

来源:互联网 发布:淘宝wap流量危险吗 编辑:程序博客网 时间:2024/04/28 21:47
 void smtpIp(char * url)
 {
HOSTENT * iphost;
char ipconfig[20];
iphost =gethostbyname("tieren.2288.org");
if(iphost!= NULL)
{
int i = 0;


while(iphost->h_addr_list[i])
{
char ip[20];
memcpy(&ip, inet_ntoa(*((struct in_addr *)iphost->h_addr_list[i])), 20);
printf("%s", ip);


memset(ip, '\0', 20);
i++;
}
}

int b = 0;

}

0 0
原创粉丝点击