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

Dotted decimal notation, Dotted decimal representation is a syntactic form ...

Dotted decimal representation is a syntactic form the IP software uses to express 32-bit binary numbers when communicating with humans. Dotted decimal presents every octet in decim

Connection oriented multiplexing and de multiplexing, Connection Oriented M...

Connection Oriented Multiplexing And De multiplexing TCP socket  identified by 4 tuple: a.Source IP address b.Source port number c.Destination IP address d.Destina

Packet cost - network layer and routing , Packet  Cost Both  distance ...

Packet  Cost Both  distance vector and link  state  routing  are lowest  algorithms. Tow factors  govern  how  cost is applied to packets  in determines  a route. Cost  is a

Define in details about computer networks, Define in details about compute...

Define in details about computer networks ? Discuss a variety of types of networks topologies in computer network. Also discuss a variety of costs and disadvantage of all topology

The cut-through switching technique work, How does the cut-through switchin...

How does the cut-through switching technique work? Ans) Cut-Through switching copies only the destination address which is the first 6 bytes after the =frame preamble into its b

Approach for client - server communication, Client Once the GUI applicat...

Client Once the GUI application is loaded, it will send a request (instance/object of Commands class) to server for a list of files from the server's shared directory.Client wil

What is a dns resource record, What is a DNS resource record? A resourc...

What is a DNS resource record? A resource record is an entry in a name server's database. There are various types of resource records used, containing name-to-address resolutio

Control - transport layer, Control This field  defines 6 different  co...

Control This field  defines 6 different  control  bits or  flags. These bits  enable flow  control  connection  establishment  and termination connection abortion and the mode

What are the possible ways of data exchange in ccna, Normal 0 f...

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

Define about unix systems and windows servers, What protocol can be applied...

What protocol can be applied when you need to transfer files between different platforms, such among UNIX systems and Windows servers? Use FTP (File Transfer Protocol) for file

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