3

I read about TCP/IP Illustrated, Volume 1: The Protocols (2nd Edition) 13.2 TCP Connection Establishment and Termination, and the following picture shows the TCP connection and termination process, what confuse me is the sequence number of ACK sent by client in termination process, just like the picture shows: enter image description here when server send FIN+ACK, Seq=L, ACK=K+1,(options) to client, this means that server need a segment whose sequence number is K+1, so I think the client should send ACK, Seq=K+1, ACK=L+1, (options) to server, right?

cong
  • 145
  • 1
  • 6
  • I'm not asking why we need three segments to establish a connection and four to terminate one but the sequence number in the termination process, I don't think it duplicated with [Why do we need a 3-way handshake? Why not just 2-way?](https://networkengineering.stackexchange.com/questions/24068/why-do-we-need-a-3-way-handshake-why-not-just-2-way) – cong Jan 18 '18 at 07:16

1 Answers1

2

It is clearly spelled out in RFC 793 Transmission Control Protocol, Section 3.5 Closing a Connection:

      TCP A                                                TCP B

  1.  ESTABLISHED                                          ESTABLISHED

  2.  (Close)
      FIN-WAIT-1  --> <SEQ=100><ACK=300><CTL=FIN,ACK>  --> CLOSE-WAIT

  3.  FIN-WAIT-2  <-- <SEQ=300><ACK=101><CTL=ACK>      <-- CLOSE-WAIT

  4.                                                       (Close)
      TIME-WAIT   <-- <SEQ=300><ACK=101><CTL=FIN,ACK>  <-- LAST-ACK

  5.  TIME-WAIT   --> <SEQ=101><ACK=301><CTL=ACK>      --> CLOSED

  6.  (2 MSL)
      CLOSED

                         Normal Close Sequence

                               Figure 13.

The RFC is the definition of TCP, and textbooks may have errors (it happens all the time). It is a good idea to also study the RFCs of any protocols which you are learning.

Ron Maupin
  • 98,218
  • 26
  • 115
  • 191