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
Q. Show Upper Layers of tcp-ip model? The Session Layer - The Session layer allows two parties to hold ongoing communications called a session across a network. - Not

DEFINITION: Latency = Delay. Because a store and forward switch reads the entire frame before forwarding, a larger frame takes longer than a shorter frame.

Describe in detail with example how data fragmentation works?

Q. Define the Backbone Networks? Backbone Networks - Allows several LANs to be connected - Non of station is directly connected to the backbone - Stations are part

What is Error Detection? What are its methods? Data can be corrupted during transmission. For reliable communication errors must be deducted and corrected. Error Detection uses

Q. Explain Simple Mail Transfer Protocol? Electronic Mail -Simple Mail Transfer Protocol (SMTP) is used to support email on the Internet -Addressing consists of two pa

CAUSES OF FAILURES Every failure has a well-defined cause.  Any system or device has an inherent strength or capacity to resist failures. This depends on design, material, man

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Transmission robustness and security Unless properly designed, a wireless LAN might be interference prone and simply eavesdropped. The design of a wireless LAN must allow relia

Define the term Socks- Network security As it is well known, each type of network security protects data at a different layer of the OSI model. Built-in at each layer lies the