Ip checksum, Computer Networking

This code properly implements the IP checksum function on a 32-bit machine: unsigned short cksum(unsigned short *buf, int count)
unsigned long sum = 0;
while (count--) {
sum += *buf++;
if (sum & 0xFFFF0000) {
sum &= 0xFFFF;
return ~(sum & 0xFFFF);
The if statement performs "wraparound" if the sum over?ows 16 bits. That is, it takes the 1 that over?owed into the 17th bit and adds it to the lower 16 bits of the sum.

Here's how to compute and check the checksum. The sender should perform these actions:

1. Completely ?ll in the IP header, with zero in the checksum ?eld.

2. Compute the checksum and store it in the checksum ?eld.

The receiver should perform these actions:

1. Copy the checksum ?eld's value into a variable.

2. Zero the IP header's checksum ?eld.

3. Compute the checksum over the IP header.

4. Compare the computed checksum value with the value in the variable.

Posted Date: 3/15/2013 1:10:27 AM | Location : United States

Related Discussions:- Ip checksum, Assignment Help, Ask Question on Ip checksum, Get Answer, Expert's Help, Ip checksum Discussions

Write discussion on Ip checksum
Your posts are moderated
Related Questions
In slotted Aloha system, it has been measured that 70% of slots are occupied by frames (i.e. the remaining slots are empty).  a)  How many frames need to be transmitted, on aver

Consider a subnet with subnet prefix 101.101.101/24  a)  If you subdivide the subnet into four equal size subnets, what are their prefixes? Give all four prefixes in the form a.

system files

Computer Networks 1. Differentiate WAN and LAN. 2. Describe the TCP/IP Reference Model with diagram. 3. Explain Circuit switching and message switching. 4. List the fu

FORMAT OF HARDWARE ADDRESS:    It have of a numeric value and its size is chosen for specific network technology. The length of the message format is one to six bytes.

What do you mean by platform independence? Platform independence means that we can write and compile the java code in one platform (eg Windows) and can implement the class in a

How to define a constant variable in Java? The variable should be declared as static and final. So only one copy of the variable exists for all instances of the class and the v

What is Remote Procedure Call (RPC)? RPC hides the intricacies of the network by using the ordinary process call mechanism familiar to every programmer. A client process calls

IP plus port (IP on layer 3 and port on Layer 4 - In Encapsulation, socket base decision on Network Layer -Layer 3)

We can deactivate advanced editing us using  terminal no editing