linux下网络编程中用到的一些头文件简介
1.netinet/in.h
1)socketaddr_in 结构体
2)htons系统调用
2.netdb.h(定义为网络数据库操作)
具体见http://pubs.opengroup.org/onlinepubs/7908799/xns/netdb.h.html
Unix和Linux特有的头文件,主要定义了与网络有关的结构、变量类型、宏、函数等。
1)struct hostent*gethostbyaddr(const void *addr, size_t len, int type);/*通过IP地址获得主机有关的网络信息*/
2)struct hostent*gethostbyname(const char *name);/*通过主机名获得主机的网络信息*/
3)hostent结构体
4)netent结构体
3.sys/socket.h
具体见http://blog.csdn.net/hellolingyun/article/details/38896157
4.arpa/inet.h
主要定义了格式转换函数

浙公网安备 33010602011771号