Wednesday, January 11, 2012

Peer-to-Peer Communication


Peer-to-Peer Communication
During the process of peer-to-peer communication, the protocols at each layer exchange packets of information called protocol data units (PDUs) between peer layers.

The PDU should go through OSI layers start from Application to Physical layer. When PDU  goes to Transport layer , transport layer adds its own header depending of protocol is in use ,and  PDU is called SEGMENT .So segment is PDU that transport layer adds its header to it . Then transport layer send the packet to network layer , the netwotk adds its own header , now the PDU is called  packet . Then network layer sends packet to data link layer , data link layer adds its own header and PDU at the data link layer is called FRAME . 


So the hierarchical level is like this:

DATA= Application+Presentation+Session layers

Segment= Transport layer

Packet= Network Layer

Frame= Data link layer

Bytes= Physical layer

Encapsulation and De-Encapsulation


if we review our video in OSI model again , we can get the concept of  encapsulation and de-encapsulation 

after review this video you can see that goods are encapsulated in containers and then put into truck . in the other side , reverse process occurs .

the same thing happen If one computer wants to send data to another computer, the data must first be packaged by a process called encapsulation. Encapsulation wraps data with the necessary protocol information before network transit. As the data moves down through the layers of the OSI model, each OSI layer adds a header (and a trailer, if applicable) to the data before passing it down to a lower layer.

The following steps occur to encapsulate data:

Step 1 The user data is sent from an application to the application layer.

Step 2 The application layer adds the application layer header (Layer 7 header) to the user data. The Layer 7 header and the original user data become the data that is passed down to the presentation layer.

Step 3 The presentation layer adds the presentation layer header (Layer 6 header) to the data. This then becomes the data that is passed down to the session layer.

Step 4 The session layer adds the session layer header (Layer 5 header) to the data. This then becomes the data that is passed down to the transport layer.

Step 5 The transport layer adds the transport layer header (Layer 4 header) to the data. This then becomes the data that is passed down to the network layer.

Step 6 The network layer adds the network layer header (Layer 3 header) to the data. This then becomes the data that is passed down to the data link layer.

Step 7 The data link layer adds the data link layer header and trailer (Layer 2 header and trailer) to the data. A Layer 2 trailer is usually the frame check sequence (FCS), which is used by the receiver to detect whether the data is in error. This then becomes the data that is passed down to the physical layer.

Step 8 The physical layer then transmits the bits onto the network media.


De-Encapsulation

When the remote device receives a sequence of bits, the physical layer at the remote device passes the bits to the data link layer for manipulation. The data link layer performs the following steps:

Step 1 The data link layer checks the data-link trailer (the FCS) to see if the data is in error.

Step 2 If the data is in error, it may be discarded, and the data link layer may ask for the data to be retransmitted.

Step 3 If the data is not in error, the data link layer reads and interprets the control information in the data-link header.

Step 4 The data link layer strips the data-link header and trailer, and then passes the remaining data up to the network layer .


This process is referred to as de-encapsulation. Each subsequent layer performs a similar deencapsulation process.