2007年4月23日

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

摘要: 转自[DotNet笔记]IP头和TCP头数据结构(C#版) 1 public struct ip_hdr //IP头 2 { 3 public byte h_lenver; //4位首部长度+4位IP版本号 4 public byte tos; //8位服务类型TOS 5 public ushort tota... 阅读全文

posted @ 2007-04-23 16:41 BugHunter 阅读(564) 评论(0) 推荐(0) 编辑

struct和byte[]相互转换(用Marshal类实现)

摘要: 转自[DotNet笔记]相当于序列化与反序列化,但是不用借助外部文件1、struct转换为byte[] 1static byte[] StructToBytes(object structObj) 2 { 3 int size = Marshal.SizeOf(structObj); 4 IntPtr buffer = Marsha... 阅读全文

posted @ 2007-04-23 16:16 BugHunter 阅读(1130) 评论(0) 推荐(0) 编辑

导航