IOS和android都使用的网络编程头文件

//#define Android                  1

#include <pthread.h> //提供多线程操作的函数

#include <time.h>    //提供有关时间的函数

#include <stdio.h>

#include <stdlib.h>

#include <assert.h>

#include <ctype.h>

#include <string.h>

#include <errno.h>   //提供错误号errno的定义,用于错误处理

#include <netdb.h>   //提供设置及获取域名的函数

#include <fcntl.h>   //提供对文件控制的函数

#include <signal.h>  //提供对信号操作的函数

#include <unistd.h>  //提供通用的文件、目录、程序及进程操作的函数

#include <dirent.h>  //文件夹操作函数

#ifdef Android

#include <linux/sockios.h>

#include <linux/rtc.h>

#include <linux/mii.h>

#include <linux/netlink.h>

#include <linux/rtnetlink.h>

#include <netinet/ether.h>

#include <netinet/ip_icmp.h>

#include <net/route.h>

#include <net/if_arp.h>

#include <asm/types.h>

#endif  //end Android

//以下是Android和IOS都可用的文件

#include <netinet/in.h>  //定义数据结构sockaddr_in

#include <net/if.h>      //配置ip地址,激活接口,配置MTU等接口信息

#include <sys/socket.h>  //提供socket函数及数据结构

#include <sys/ioctl.h>   //提供对I/O控制的函数

#include <sys/types.h>   //数据类型定义

#include <sys/select.h>  //select模型相关函数

#include <arpa/inet.h>   //提供IP地址转换函数

//#include <sys/poll.h>  //提供socket等待测试机制的函数


转自:https://blog.csdn.net/nogodoss/article/details/43670373 
 

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...