-
计算校验和
校验和算法描述:为保证网络上传输的数据的可靠性,在许多协议中都设置了校验和项,例如:IPv4、ICMPv4、IGMPV4、ICMPv6、UDP...
计算校验和
校验和算法描述:为保证网络上传输的数据的可靠性,在许多协议中都设置了校验和项,例如:IPv4、ICMPv4、IGMPV4、ICMPv6、UDP和TCP 等等。计算这些校验和的算法称为网际校验和算法,简单来说就是:把被校验的数据16位进行累加,然后取反码,若数据字节长度为奇数,则数据尾部补一个字节的0以凑成偶数。
由于从输入文件读入的数据不能直接满足计算校验和的条件,所以首先对从文件读入缓冲区的数据进行预处理,即读入缓冲区时忽略空格。由于累加是按16位进行的,所以每次从缓冲区中读出4个字符,并将字符转换成对应的16进制数字,如此依次累加,直至数据全部读完。
还有一种情况,即如果数据长度为奇数个字节,则需要判断,并补0累加。程序中利用的是缓冲区长度计数器i和当前读取到计数器j判断数据长度是否为奇数。即如果数据长度为偶数,则读完数据时当前读取到计数器j的值应与缓冲区长度i相等,而如果数据长度为奇数,则读完数据时,当前读取到计数器j>缓冲区长度i,此时需将缓冲区中剩余的两个字符读出,并补0,转换成相应16进制数以后参与累加。
当累加结束后,将累加和的16位以上数据位移下再进行一次累加,并对最后累加和取反即得所求校验和。
-calculated checksum checksum algorithm Description : To ensure the network transmission of data reliability, in many of the agreements are set up and calibration, for example : IPv4, ICMPv4, IGMPV4, ICMPv6. UDP and TCP so on. Calculating checksum algorithm called the Internet checksum algorithm, the simple answer is : as has been the calibration data for 16 cumulative, and then take the anti-code, if the data byte length of the odd, data will make up the tai
- 2022-01-26 06:39:03下载
- 积分:1
-
ConsoleWinSrvc
创建Windows Service,启动客户端服务程序,启动定时器,定时监控客户端服务程序是否正常,通讯方式采用WCF以及同步事件。(Create a Windows Service, start the client service program, start the timer, the timer monitoring client service program is working, communication and synchronization using WCF events.)
- 2014-01-20 11:06:13下载
- 积分:1
-
TKXH_simulink
消弧线圈在系统应用中的仿真,主要针对接地后的补偿效果(ARC coil )
- 2020-11-16 22:09:39下载
- 积分:1
-
Programming_In_Lua
Lua 就被设计成很容易和传统的 C/C++整合的语言。这种语言的二元性带
来了极大的好处。Lua 是一个小巧而简单的语言,因为 Lua 不致力于做 C 语言已经做得
很好的领域,比如:性能、底层操作以及与第三方软件的接口。Lua 依赖于 C 去做完成
这些任务。Lua 所提供的机制是 C 不善于的:高级语言、动态结构、简洁、易于测试和
调试等。正因为如此,Lua 具有良好的安全保证,自动内存管理,简便的字符串处理功
能及其他动态数据的改变。(Lua was designed to be easily integrated with the traditional C/C++ language. The duality of the language
To the great benefits. Lua is a small and simple language, because the Lua is not committed to doing the C language has done
Good domain, such as performance, the underlying operating and the interface with third party software. Lua is dependent on C to complete
These tasks. Lua mechanism is provided by C are not good at: a high-level language, dynamic structure, concise, easy to test and
Debugging, etc. Because of this, the Lua has good security, automatic memory management, simple string handling work
Can change, and other dynamic data.)
- 2014-12-26 16:52:07下载
- 积分:1
-
Development.Programming.VB.code.ope.file
VB开发打开文件编程设计代码Development Programming VB code to open the file
(Development Programming VB code to open the file
)
- 2010-10-31 21:45:20下载
- 积分:1
-
use ie cache and development agreement http download the examples, applicable to...
利用ie cache 和 http 协议开发下载程序的例子,适用于简单的网络下载。-use ie cache and development agreement http download the examples, applicable to simple networks to download.
- 2022-02-15 07:56:33下载
- 积分:1
-
jdkANdjre
jdk与jre的重要区别,好东西我不是这么轻易与人分享的(jdk and jre an important distinction, good thing I' m not so easily shared with others)
- 2013-07-25 10:54:03下载
- 积分:1
-
ACI_FOC_matlab
这是PMSM电机中关于FOC算法的纯代码实现,通过M文件实现了算法。(This is the pure code implementation of FOC algorithm in PMSM motor, and the algorithm is implemented through M file.)
- 2018-11-12 08:45:14下载
- 积分:1
-
WinSocket的示例程序,多线程,对于初学者有很大的价值
WinSocket的示例程序,多线程,对于初学者有很大的价值-Winsocket examples of procedures, multithreading, beginners have great value
- 2022-04-13 10:46:00下载
- 积分:1
-
这个程序是用DELPHI编写的,主要用于与BORLAND服务器进行聊天的客户端工具....
这个程序是用DELPHI编写的,主要用于与BORLAND服务器进行聊天的客户端工具.-the procedure is used in the preparation of Delphi, mainly for servers with BORLAND Chat client tools.
- 2022-05-06 17:29:15下载
- 积分:1