Ip checksum, Computer Networking

Assignment Help:

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.


Related Discussions:- Ip checksum

Explain 10base2 - thinnet, 10Base2 - Thinnet Cable diameter is abou...

10Base2 - Thinnet Cable diameter is about 0.64 cm (RG-58) More flexible as well as easier to handle and install than Thicknet "2" represents a maximum segment len

What is border gateway protocol, What is BGP (Border Gateway Protocol)? ...

What is BGP (Border Gateway Protocol)? It is a protocol used to promote the set of networks that can be reached within an autonomous system. BGP enable this information to be c

TCP for live video, 1. What advantages and disadvantages does TCP have for ...

1. What advantages and disadvantages does TCP have for live video teleconferencing applications

Transmission robustness and security, Transmission robustness and security ...

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

Link-state routing, In link-state routing network topology is filled from...

In link-state routing network topology is filled from route calculation. Switches send link-state information about local joins. Every switch creates own routing tables. It needs

Command to view the configuration-register value, Recognize the command to ...

Recognize the command to view the configuration-register value Ans) show version is the command to view the configuration-register value

Explain transparent bridges and learning bridges, Transparent Bridges & Lea...

Transparent Bridges & Learning Bridges - Builds table by examining destination as well as source address of each packet it receives - Learning bridges - If address is not

Concurrently read exclusively write (crew), This  is one of the models base...

This  is one of the models based on PRAM. In this, the processors access the memory location parallel for reading while exclusively for writing operations. In the algorithm which u

Give examples of the application layer, Pretty much any end-user program is...

Pretty much any end-user program is an best example of the Application Layer.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd