struc.t hosten.t *phe = NULL; /* host entry */ 电子
struct .servent *pse = NULL; . . /* port number */.
struct protoent *ppe = NULL; . . /* protocol nu.mber */ 美容
.struct s.ockaddr_in sin;服务器
int. s, type;服务器
. char name[20]; 健康
memset(&..sin, 0, sizeof(sin)); 美容
sin.sin_family = AF_INET; /* Add.ress. Family: Internet IP Protocol . */ 电子
getho.stname(name., 20);.
/* map hostname to ip ad.dress */..
. if( phe = gethostbyna.me(name) ).
m.emset(&sin.sin_addr, p.he->h_addr, phe->h_length); . <性病>
printf("ip address is. %s\n", inet_ntoa(sin.sin_addr)).;.
主机名name是队的,p.he也不是NULL,为什么打印出来.的ip地址就不对呢?服务器
机器只有一个网卡