1
10kviews
Draw and explain connection establishment using 3 way handshaking in TCP.
1 Answer
1
289views

Connection Establishment:

TCP transmits data in full-duplex mode. When two TCPs in two machines are connected, they are able to send segments to each other simultaneously. This implies that each party must initialize communication and get approval from the other party before any data is transferred.

Three-Way Handshaking:

  • The connection establishment in TCP is called three-way handshaking.
  • In our example, an application program, called the client, wants to make a connection with another application program, called the server, using TCP as the transport layer protocol.
  • The process starts with the server. The server program tells its TCP that it is ready to accept a connection. This is called a request for a passive open.
  • Although the server TCP is ready to accept any connection from any machine in the world it cannot make the connection itself.
  • The client program issues a request for an active open. A client that wishes to connect to an open server tells its TCP that it needs to be connected to that particular server.
  • TCP can now start the three-way handshaking process as shown in Figure1.
  • To show the process we use two time lines: one at each site. Each segment has values for all its header fields and perhaps for some of its option fields too. There is sequence number, the acknowledgment number, the control flags and window size if not empty.
  • The three steps in this phase are as follows.
  1. The client sends the first segment, a SYN segment, in which only the SYN flag is set:
    • This segment is for synchronization of sequence numbers. The client in our example chooses a random number as the first sequence number and sends this to the server.
    • This sequence number is called the initial sequence number (ISN). Note that this segment does not contain an acknowledgment number.
    • It does not define the window size either; a window size definition makes sense only when a segment includes an acknowledgment.
    • The segment can also include some options that we discuss later in the chapter. Note that the SYN segment is a control segment and does not early any data.
    • However, it consumes one sequence number. When the data transfer starts, the sequence number is incremented by 1. We can say that the SYN segment carries no real data, but we can think of it as containing one imaginary byte.
  2. The server sends the second segment, a SYN + ACK segment with two flag bits set: SYN and ACK.
    • This segment has a dual purpose. First, it is a SYN segment for communication in the other direction. The server uses this segment to initialize a sequence number for numbering the bytes sent from the server to the client.
    • The server also acknowledges the receipt of the SYN segment from the client by setting the ACK flag and displaying the next sequence number it expects to receive from the client.
    • Because it contains an acknowledgment, it also needs to define the receiver window size, rwnd (to be used by the client) as we will sec in the flow control section. A SYN + ACK segment cannot carry data, but does consume one sequence number.

enter image description here

  1. The client sends the third segment. This is just an ACK segment.
    • It acknowledges the receipt of the second segment with the ACK flag and acknowledgment number field.
    • The sequence number in this segment is the same as the one in the SYN segment: the ACK segment does not consume any sequence numbers.
    • The client must also define the server window size. Some implementations allow this third segment in the connection phase to carry the first chunk of data from the client.
    • In this case, the third segment must have a new sequence number showing the byte number of the first byte in the data. In general, the third segment usually does not carry data and consumes no sequence numbers.
Please log in to add an answer.