Skip to main content

data on OSI layerz

More
13 years 1 month ago #36528 by sose
Replied by sose on topic Re: data on OSI layerz
Before two hosts can communicate via a TCP/IP connection, a connection of “trust" must first be established, as a means of communication. The TCP connection establishment process is divided in three parts, also known as "The three-way-handshake".
TCP is a connection-oriented protocol. TCP requires a connection to be established before data transfer begins. The two hosts must synchronize their initial sequence numbers to establish a connection. Synchronization occurs through an exchange of segments that carry a synchronized (SYN) control bit and the initial sequence numbers. This solution requires a mechanism that picks the initial sequence numbers and a handshake to exchange them.
The synchronization requires each side to send its own initial sequence number and to receive a confirmation of exchange in an acknowledgment (ACK) from the other side. Each side must receive the initial sequence number from the other side and respond with an ACK. The sequence is as follows:
1. The sending host (A) initiates a connection by sending a SYN packet to the receiving host (B) indicating its Initial Sequence Number( INS) = X:
A - > B SYN, seq of A = X
2. B receives the packet, records that the seq of A = X, replies with an ACK of X + 1, and indicates that its INS = Y. The ACK of X + 1 means that host B has received all octets up to and including X and is expecting X + 1 next:
B - > A ACK, seq of A = X, SYN seq of B = Y, ACK = X + 1
3. A receives the packet from B, it knows that the seq of B = Y, and responds with an ACK of Y + 1, which finalizes the connection process:
A - > B ACK, seq of B = Y, ACK = Y + 1
This exchange is called the three-way handshake.
A three-way handshake is necessary because sequence numbers are not based on a global clock in the network and TCP protocols may use different mechanisms to choose the initial sequence numbers. The receiver of the first SYN would not know if the segment was delayed unless it kept track of the last sequence number used on the connection. If the receiver does not have this information, it must ask the sender to verify the SYN.


A TCP/IP connection between two hosts must be closed. To do this, the two hosts alternatively use a “four-way-handshake", just as a "three-way-handshake" is used to initiate a connection. Here is the sequence of packets sent:



CLIENT: FIN (SN) -> SERVER
SERVER: ACK (SN + 1) -> CLIENT
SERVER: FIN (SN) -> CLIENT
CLIENT: ACK (SN + 1) -> SERVER

The connection, given a few seconds (usually 30-120 seconds), will be brought to a complete close. As you can probably gather what is happening, I will give only a brief explanation of what is happening: The CLIENT (or SERVER, for that matter) sends a FIN packet to the SERVER (to tell it that it has finished sending data), with the correct sequence number. The SERVER then sends a responding packet back, with the ACK bit set, to acknowledge the receipt of the packet, with the ACK number as the SN (Sequence Number) + 1. The SERVER then proceeds to send another packet, this time one with the correct sequence number set, and the FIN flag set. To finish off the four-way-handshake, and to close the connection, the CLIENT sends an ACK packet, with the ACK number as the Server’s SN + 1.
  • truesdq
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • I am simple and have friendly nature
More
13 years 1 month ago #36550 by truesdq
Replied by truesdq on topic Re: data on OSI layerz
thank very much SOSE , manojsharma
U really made a triiffic explanation.
______________________

and i would ask about session layer because thiz layer also responsible for establishing and terminating connection So would u tell me about these ?

although i asked it in separated Question but not found its ans yet...

simplest
More
13 years 1 month ago #36553 by manojsharma
Replied by manojsharma on topic Re: data on OSI layerz
you are welcome truesdq...

Well the session layer as the name of this layer tells you much about what it is designed to do: to allow devices to establish and manage sessions.

In general terms, a session is a persistent logical linking of two software application processes, to allow them to exchange data over a prolonged period of time.
These sessions are called dialogs; they are roughly analogous to a telephone call made between two people.

The primary job of session layer protocols is to provide the means necessary to set up, manage, and end sessions. In fact, in some ways, session layer software products are more sets of tools than specific protocols. These session-layer tools are normally provided to higher layer protocols through command sets often called application program interfaces or APIs.


Common APIs include NetBIOS, TCP/IP Sockets and Remote Procedure Calls (RPCs). They allow an application to accomplish certain high-level communications over the network easily, by using a standardized set of services. Most of these session-layer tools are of primary interest to the developers of application software. The programmers use the APIs to write software that is able to communicate using TCP/IP without having to know the implementation details of how TCP/IP works.

The session layer carries out the following tasks.

Starts and ends a session across a network (on request)
Allows applications to share information.
Ensures that information is flowing to the right place
Talks to the PRESENTATION layer above
Talks to the TRANSPORT layer below.

  • truesdq
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • I am simple and have friendly nature
More
13 years 1 month ago #36559 by truesdq
Replied by truesdq on topic Re: data on OSI layerz
@manojsharma My Pleasure

i must ask again that if session layer make established connection's session and terminating as well..
so what about the 3 handshake and 4 handshake of the trasport layer meanz?

when i thinking about these then once again i could be in confusion..

would you give me explained the differences between them?

simplest
Time to create page: 0.145 seconds