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;
sum++;
}
}
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
Parallel Programming Environment Characteristics  The parallel programming environment consists of an debugger, a editor,  performance evaluator and programme visualizer for i

It is possible for a datagram to generate ICMP errors after it has been fragmented. For example, suppose that each of two fragments cannot be delivered. Seemingly, this would mean



What are the five major network services? Major Network Services are: a. File Services b. Message Services c.  Print Services  d.  Application Services e.  Datab

Write the definition of IPX and UDP IPX: Inter-network Packet Exchange supports the transport and network layers of the OSI network model. It provides fast, unreliable, communi

Q. Illustrate about RSA Encryption? RSA Encryption - Public key encryption technique - Encryption steps: - Encode data to be encrypted as a number to create the pla

Application of Satellite Communication started with the installation and commissioning of STD- “B” Earth Station having 11m diameter antenna in 1982, Initially with to only three

What are routers? Routers work to connect two or more network segments. These are the most intelligent network devices that store information in its routing table like paths, h

Q. What are the basic key functions of data link layer? Ans: Data link layer transfers data in a structured and reliable manner so that the service given by the physical layer