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

State ethernet frame format, Ethernet Frame Format Consists of sev...

Ethernet Frame Format Consists of seven fields There is No mechanism for acknowledging received frames considered an unreliable medium

Enable wireless security - ccna, Enable Wireless Security Step : Confi...

Enable Wireless Security Step : Configure Windows to use WEP authentication.  Navigate to the Network Connections page again and right-click the Wireless Network Connection

Show the network layer in an internetwork, Q. Show the Network layer in an ...

Q. Show the Network layer in an internetwork? - Receives data from Transport layer - Responsible for creating Packet - Each packet contains - Universal Address of Sour

Difference among flow control and error control, What is the difference am...

What is the difference among  flow control and error control?    Ans) Flow control: adjust and confirm data flow rate for successful transmission. Error Control: a method to

Illustrate data-link layer in osi layers model, Q. Illustrate Data-Link Lay...

Q. Illustrate Data-Link Layer in osi layers model? Data-Link Layer: This layer takes the data messages or frames from the Network Layer and gives for their actual transmissio

Distortion, what is the differnce between noise and distortion

what is the differnce between noise and distortion

Retransmission of packets - transport layer, Retransmission of packets ...

Retransmission of packets The disadvantage  of thronging away a correctly received packet is that  the subsequent retransmission  of the  packet might  be lost  or garbled and

Describe osi routing architecture, Q. Describe OSI Routing Architecture? ...

Q. Describe OSI Routing Architecture? End systems (ESs) as well as intermediate systems (ISs) use routing protocols to distribute (-advertise?) some or all of the informati

Summary of special ip addresses, The table below gives a summary of special...

The table below gives a summary of special IP addresses.

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