-
计算校验和
校验和算法描述:为保证网络上传输的数据的可靠性,在许多协议中都设置了校验和项,例如: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
-
tcpdump代码 包括自己实现的协议截包驱动
tcpdump代码 包括自己实现的协议截包驱动-tcpdump including its own code to achieve an agreement cut package drive
- 2023-07-10 02:10:03下载
- 积分:1
-
ASP网络编程实例源程序,对初学ASP网络编程很有帮助
ASP网络编程实例源程序,对初学ASP网络编程很有帮助-ASP source example of network programming, network programming for the novice ASP helpful
- 2022-06-15 14:30:06下载
- 积分:1
-
一个IOCP的示例,封装了IO完成端口的IO模型。可以用做学习参考,也可以直接使用其中封装的类。...
一个IOCP的示例,封装了IO完成端口的IO模型。可以用做学习参考,也可以直接使用其中封装的类。-a IOCP example, the complete package, IO port IO model. Learning can be used as reference, which can be used directly to the Packaging category.
- 2022-01-24 18:57:17下载
- 积分:1
-
基于一个手机短信发送平台,服务器使用IOCP线程池,数据库使用线程池保存数据,可以同时处理上千用户的数据,服务器每秒可以处理1000左右条短信...
基于一个手机短信发送平台,服务器使用IOCP线程池,数据库使用线程池保存数据,可以同时处理上千用户的数据,服务器每秒可以处理1000左右条短信-Send message based on a mobile phone platform, the server using IOCP thread pool, thread pool to use the database to preserve data, can handle thousands of user data, the server can handle per second 1000 article about message
- 2022-11-28 11:15:03下载
- 积分:1
-
一个vc下的通讯程序
一个vc下的通讯程序-a vc the communication process
- 2022-03-18 13:17:12下载
- 积分:1
-
简单网络聊天室,学习用
简单网络聊天室,学习用-simple Internet chat room, to study
- 2022-11-15 07:25:04下载
- 积分:1
-
This procedure is a break point continues passes on the
document procedure the c...
本程序为一断点续传文件程序的客户端程序.
采用了多线程技术,速度明显高于同类软件.- This procedure is a break point continues passes on the
document procedure the customer end procedure Used the multi-thread
technology, the speed has obviously been higher than similar software
- 2022-02-02 01:23:12下载
- 积分:1
-
C2风格的局域网聊天程序,实现局域网中两个Client聊天。这个程序分Server和Client两部分,但是和网上流行的Server与Client聊天不同,它是...
C2风格的局域网聊天程序,实现局域网中两个Client聊天。这个程序分Server和Client两部分,但是和网上流行的Server与Client聊天不同,它是实现的Client与Client 聊天,Server 仅仅提供消息转发功能,因此执行程序时,首先必须有两台以上的电脑来执行,必须保证两个Client(Client程序是相同的,因此只要复制两个Client就行)在不同的局域网上的电脑,局域网中只要有一个Server就行,通过输入IP以及确认码(其实就是端口号,要保证两个Client的端口号相同,且两个Client的IP地址不同,即不在同一电脑上),就能实现一个Client和另一个Client聊天(当然Server必须运行,且必须按提示输入信息),本程序基于UDP协议,并且利用多线程编程实现了程序的背景音乐(系统的Beep声音必须打开才能听见)以及正常退出功能(点右上角的“差”是非正常退出!),当初设计的时候使得两个Client端口号必须相同,今后会设计出两个Client端口号不同,这样就能在一台机子上执行程序了。 -This program has the function that it can make two Clients communicate on the LAN.The program has Server and Client two parts.However,it is different from the popular CS chat program which has the function of communicating from Server and Client on the web.It makes two Clients chat.The server only be assigned to transmit messenger from one Client to another.So,you should have more than two Computer to run the program,and to ensure that two Clients on the different Computers which is on the same LAN.The LAN has one Server is OK
- 2022-12-17 06:10:05下载
- 积分:1
-
邮件发送控件源码
邮件发送控件源码-spammers source control
- 2023-07-26 14:55:03下载
- 积分:1