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
Network Data Storage 1. What is the Small Computer System Interface Architecture 2. Describe the various Fibre Channel standards. 3. What is the difficulties in building

Suppose there are exactly five packet switches (Figure 4) between a sending host and a receiving host connected by a virtual circuit line (shown as dotted line in figure 4). The tr

Define Encoder? A device or program that uses predefined algorithms to encode, or compress audio or video data for storage or transmission use. A circuit that is used to change

Question: (a) With the help of a diagram, describe a typical DNS system. (b) Using signal sequence or state transition diagrams, illustrate the following scenarios: i.

Q. Explain about Domain Name System? -In the past, mapping of IP addresses was static using a host file -Impossible in today's dynamic environment -Domain Name System (DN

What are the benefits accruable from networks The exact number of benefits accruable from networks cannot be enumerated easily in terms of monetary benefit. In order to unde

Token Bus Frame Format No length field Data is able to be much larger (timers prevent hogs) Frame control Ack required? Data vs Control frame and how is

Intranets are fundamentally "small" Internets. They employ the same network facilities which the Internet does, however access is limited to a restricted sphere. For example, a com

Determine the term- Web Server and Webmaster Web Server: A host computer that stores Web pages and responds to requests for viewing. Web servers communicate with Web browse

Determine about the TCP/IP Stands for Transmission Control Protocol/Internet Protocol. This is the group of protocols that define the Internet and communication method used