文章收藏-FAQ 位置:电脑学习网

IP 头和 TCP 头数据结构(C#版)

    public struct ip_hdr    //IP头
     {
         public byte h_lenver; //4位首部长度+4位IP版本号
         public byte tos; //8位服务类型TOS
         public ushort total_len; //16位总长度(字节)
         public ushort ident; //16位标识
         public ushort frag_and_flags; //3位标志位+13报片偏移
         public byte ttl; //8位生存时间 TTL
         public byte proto; //8位协议 (TCP, UDP 或其他)
         public ushort checksum; //16位IP首部校验和
         public uint sourceIP; //32位源IP地址
         public uint destIP; //32位目的IP地址
     }
     public struct tcp_hdr   //TCP头
     {
         public ushort th_sport; //16位源端口
         public ushort th_dport; //16位目的端口
         public uint th_seq; //32位序列号
         public uint th_ack; //32位确认号
         public byte th_lenres; //4位首部长度/6位保留字
         public byte th_flag; //6位标志位
         public ushort th_win; //16位窗口大小
         public ushort th_sum; //16位校验和
         public ushort th_urp; //16位紧急数据偏移量
     }

     [文章来源:“十万个为什么”电脑学习网]
     [网络地址:http://why100000.com]
     [版权声明:除本站部分特别声明禁止转载的专稿外,其他的文章可以自由转载,但请务必注明出处和原始作者。本站文章版权归文章原作者所有。如果本站转载的文章有版权问题请联系本站,我们会尽快予以更正。]
 

【字体:[大] [中] [小] 【加入收藏】 【发表评论】 【关闭本窗口】

Copyright © “十万个为什么”电脑学习网 2000-2007 陕ICP备06007929号
站务联系:MSN & Email:zhangking2008@gmail.com  QQ:9365822