struct hostent* hostdata;
char ipadd[]="192.168.205.42";
hostdata = (struct hostent*)malloc(sizeof(struct hostent)); //这句不知道要不要
unsigned long ip = inet_addr(ipadd);
hostdata = gethostbyaddr((char*)&ip,sizeof(ip),PF_INET); 
printf("host   name:   %s\n",hostdata->h_name); 
//程序运行到这里发生错误,应该是gethostbyaddr函数的问题,请大家帮帮!!!(gethostbyaddr我不太会用啊)