//填充IP首部
ipHeader.h_verlen=(4<<4 | sizeof(ipHeader)/sizeof(unsigned long));
// ipHeader.tos=0;
ipHeader.total_len=htons(sizeof(ipHeader)+sizeof(tcpHeader));
ipHeader.ident=1;
ipHeader.frag_and_flags=0;
ipHeader.h_verlen=(4<<4 | sizeof(ipHeader)/sizeof(unsigned long));
// ipHeader.tos=0;
ipHeader.total_len=htons(sizeof(ipHeader)+sizeof(tcpHeader));
ipHeader.ident=1;
ipHeader.frag_and_flags=0;
解决方案 »
- 如何将在一个窗口的操作信息传到别一个窗口中去。
- 大牛,救救我吧~~~~~~~~~~~mfc http连接
- 多线程高手请进,在线等
- VC 6.0中运行出错!
- 关于驱动级的键盘模拟
- VC6中使用MFC ODBC连接数据库,怎样实现三表连接查询
- 关于vs 2008 中MFC 的xp风格问题
- 江湖救急!!!
- 遇到麻烦 看看应该怎么做呢,关于多语言界面?
- 错误 4 error C2664: 'FindFirstFileA' : cannot convert parameter 2 from 'LPWIN32_FIND_DATAA *__w64 ' to 'LPWIN32_FIND_DATAA'
- 下面代码发送的数据为什么接收不到?
- VB里的CreateObject函数在VC++里对应的是什么?
这句是做什么?
ipHeader.h_verlen=(4<<4 | sizeof(ipHeader)/sizeof(unsigned long));
这句就是填充这两个字段
把版本号4左移4位。
sizeof(ipHeader)/sizeof(unsigned long));
首部长度是以4字节(32位)衡量,上一句=5,
然后和版本号组合就得到总一个字节的版本号和长度:
ip.ver=4
ip.hlen=5