No.80647 作者:whutfrank515 邮件:whutfrank515@163.com ID:25804 登陆:7次 文章数:2篇 最后登陆IP:218.104.96.141 最后登陆:2005/7/9 8:34:32 注册:2004/9/20 9:16:41 财富:113 发帖时间:2005/7/1 9:29:24 发贴者IP:218.104.96.141 标题:whutfrank515:用KEIL C51编的UDP打包程序 摘要:No.80647用KEIL C51编的UDP打包程序 本人现在在编udp打包的程序,下面是相关的程序: 在程序头文件中定义的UDP数据报的结构: struct tagEthernet { _US len; // 为data字段的实际长度 _UC dest[6]; _UC src[6]; _US type; _UC ethdata[1]; }; struct tagIP { _UC ver_hl; _UC tos; _US len; _US id; _US flag_off; _UC ttl; _UC proto; _US chksum; union { _UL longSrc; _UC byteSrc[4]; } src; union { _UL longDest; _UC byteDest[4]; } dest; _UC ipdata[1]; }; struct tagUDP { _US src; _US dest; _US len; _US chksum; _UC udpdata[1]; }; extern _UC xdata buffer[2400]; #define p ((struct tagEthernet*)buffer) // IP层提供的函数 #define iphdr ((struct tagIP*)(p-> ethdata)) void ip_in ......
>>返回讨论的主题
|