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

Determine the term- cyberspace, Determine the term- Cyberspace The c...

Determine the term- Cyberspace The conceptual or virtual area where pages, data, images, and all the rest are stored. It is the area from where requests are accepted and ful

Which osi reference layer is concerned with logical address, There are two ...

There are two logical addressing :- a) Datalink is physical (hardware) addressing. b) Network is logical (software) addressing.

Nfs, what is this ?

what is this ?

Explain about traffic shaping, Q. Explain about Traffic shaping ? Traf...

Q. Explain about Traffic shaping ? Traffic shaping -Method to control the amount and the rate of the traffic sent to the network.? Leaky bucket Token bucket -

Packet, a transperent switch is inserted between two local area networks AB...

a transperent switch is inserted between two local area networks ABC and XYZ.network ABC has workstation 1,2,and 3 and Network XYZ has workstation 4,5, and 6. show the contents of

Explain about stored procedure, A stored procedure is a named collection of...

A stored procedure is a named collection of SQL statements and procedural logic that is compiled, verified and kept in a server database. It is typically treated like any other dat

Network topologies- -fundamentals of networks, Network Topologies Topo...

Network Topologies Topology is study  of the  arrangement or  mapping of  the elements links nodes etc,  of a network especially the physical and logical inter connections bet

What is fcs, FCS= Frame Check Sequence CRC (Cyclic Redundancy Check) alg...

FCS= Frame Check Sequence CRC (Cyclic Redundancy Check) algorithm runs in switch that known as FCS (Frame Check Sequence)

Example of parallel sections construct, This example demonstrates the use o...

This example demonstrates the use of parallel sections construct. The three functions, fun1, fun2, and fun3, all can be executed concurrently.  Note that all the section directives

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