2012年7月5日
摘要: 使用这个东西,首先要包含2个头文件:#include <netdb.h>#include <sys/socket.h>struct hostent *gethostbyname(const char *name);这个函数的传入值是域名或者主机名,例如"www.google.com","wpc"等等。传出值,是一个hostent的结构(如下)。如果函数调用失败,将返回NULL。struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; 阅读全文
posted @ 2012-07-05 11:10 紫金树下 阅读(476) 评论(0) 推荐(0) 编辑