In the connection termination phase, suppose the FIN segment from the client-side contains data ranging from sequence no 100 to 200,

So will the ACK no from the server start from 201 or 202? Will the FIN flag consume 1 extra sequence number at the end, making the ACK no from server 202?

Or Will the sequence number consumed by FIN be 99, before the beginning of the data segment

  • This smells suspiciously like homework which is off-topic here...
    – Zac67
    Commented Jan 25, 2022 at 6:51
  • @Zac67 nope it's not, it's self-doubt that I got while studying Foruzan. I already posted the detailed question here gateoverflow.in/370546/Self-doubt-cn#c370590 but I am not sure whether the answer I received is correct and also couldn't find the answer on the internet
    – Tushar
    Commented Jan 25, 2022 at 7:13

1 Answer 1


According to rfc793

TCP FIN occupies one byte in sequence number space and

the FIN is considered to occur after the last actual data octet in a segment in which it occurs

The more recent RFC 9293 gives a more detailed explanation:

We have taken advantage of the numbering scheme to protect certain control information as well. This is achieved by implicitly including some control flags in the sequence space so they can be retransmitted and acknowledged without confusion (i.e., one and only one copy of the control will be acted upon). Control information is not physically carried in the segment data space. Consequently, we must adopt rules for implicitly assigning sequence numbers to control. The SYN and FIN are the only controls requiring this protection, and these controls are used only at connection opening and closing. For sequence number purposes, the SYN is considered to occur before the first actual data octet of the segment in which it occurs, while the FIN is considered to occur after the last actual data octet in a segment in which it occurs. The segment length (SEG.LEN) includes both data and sequence space-occupying controls. When a SYN is present, then SEG.SEQ is the sequence number of the SYN.

Not the answer you're looking for? Browse other questions tagged or ask your own question.