初始化套接字
int StartSock()
{
WSADATA wsaData;
if(WSAStartup(MAKEWORD(2,0),&wsaData)!=0)
{printf("初始化失败");
return -1;
}
typedef struct _iphdr
{
unsigned int h_len:4; // IP头长度
unsigned int version:4; // IP版本
unsigned char tos; // 服务类型
unsigned short total_len; // 总的数据包大小
unsigned short ident; // 特殊标识符
unsigned short frag_and_flags; // 标识
unsigned char ttl; //TTL参数
unsigned char proto; // 协议(TCP, UDP 等)
unsigned short checksum; // IP 校验和
unsigned int sourceIP;
unsigned int destIP;
} IpHeader;
typedef struct _icmphdr
{
BYTE i_type; //ICMP报文类型
BYTE i_code; // ICMP代码
USHORT i_cksum; //校验和
USHORT i_id; //标识符
USHORT i_seq; //序列号
ULONG timestamp; //时间戳
} IcmpHeader;
//
// IP 选项头
//
typedef struct _ipoptionhdr
{
这种用法在 typedef 中一般是: typedef struct tagA //故意给一个不同的名字,作为结构体的实名 { //... } A; //结构体的别名。 后者是结构体变量定义,...
C C++中typedef struct和struct的用法_IT/计算机_专业资料。C/C++中typedef struct和struct的用法C/C++中 typedef struct 和 struct 的用法 中 xml 代码 1. ...
typedef struct 用法详解和用法小结_IT/计算机_专业资料。typedef struct 用法详解和用法小结: 1. 基本解释 2. typedef & 结构的问题 2.1 typedef的最简单使用...
与数组 基本概念 typedef 为C语言中的关键字,作用是为 一个数据类型定义一个新的数据类型, 包括内部数据类型(如int,char等)和用 户自定义类型(如struct等)。 ...
第四篇:C/C++中 typedef struct 和 struct 的用法 struct _x1 { ...}x1; 和 typedef struct _x2{ ...} x2; 有什么不同? 有什么不同? 其实, ...
struct 和 typedef struct 分三块来讲述: 1 首先://注意在 C 和 C++里不同 在 C 中定义一个结构体类型要用 typedef: typedef struct Student { int a; ...
2、 typedef与结构结合使用 typedef struct tagMyStruct { int iNum; long lLength; } MyStruct; 这语句实际上完成两个操作: 1) 定义一个新的结构类型 struct ...
第四篇:C/C++中 typedef struct 和 struct 的用法 struct _x1 { ...}x1; 和 typedef struct _x2{ ...} x2; 有什么不同? 其实, 前者是定义了类_...
第三种: typedef struct student { int num ; char name[8]; char sex; double score[2]; }stu; //方法三 注意:此处并非结构体变量,而是结构体类 型...
热门文档