1 tcp帧头
source prot:源端口 16位
Destination port:目的端口 16位
sequence Number:序列号 32位
ack number:应答序号 32位
header length:头长度 4bits
resv:4位
CWR:1位
ECE:1位
URG:1位
ACK:1位
PSH:1位
RST:1位
SYN:1位
FIN:1位
Windows size:窗口大小 16bits
tcp checksum:校验和
Ugrent pointer:
options:选项
对于每个tcp包,都会包含这个帧头,例如syn=1,就是将帧头中的字段syn设置为1,然后再发送给客户端
对应代码封装
struct tcphdr{
unsigned char sport;//端口
unsigned char dport;//端口
unsigned int seqnum;//序号 随机值开始的
unsigned int acknum;// 应答序号
unsigned char hdrlen:4,