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
how to implement chord connection as the network management system ?

10Base5 - Thicknet A rigid coaxial cable (RG-8) approx 0.4 in' thick used in the original Ethernet networks Bus topology LAN utilize base signalling with a maximum se

Explain the uses of Firewall in computer For Intranet developers, restricting access of unauthorised users to the Web site has been the greatest challenge. In addition to preve

The most difficult representatives of shared memory programming models are thread libraries present in mainly of the modern operating systems. Some examples for thread libraries ar

Data Distribution Data distribution directives tell the compiler how the program data is to be distributed between the memory areas associated with a set of processors. The log

what is end to end and host to host?

What is data encapsulation? Data encapsulation is the method of breaking down information into smaller manageable chunks before it is transferred across the network. It is also

On a LAN where are IP Datagram transported?

5. Suppose that frames are 1250 bytes long including 25 bytes of overhead. Also assume that ACK frame are 25 bytes long. Calculate the efficiency of Stop-and-Wait ARQ in a system t

Define the term - Hot swapping The reliability of the machine can be dramatically improved by installing the best components. Hot swapping is a concept through which component