0% found this document useful (0 votes)
26 views13 pages

TCP Sequence Number Examples

TCP sequence numbers are used to track data transmission in both directions of a connection. The initiating host uses sequence numbers starting at 8000 and the receiving host uses sequence numbers starting at 15000. Sequence numbers are incremented for each octet of data transmitted. Connection establishment messages like SYN and FIN consume a single sequence number but ACK messages do not if no data is carried.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views13 pages

TCP Sequence Number Examples

TCP sequence numbers are used to track data transmission in both directions of a connection. The initiating host uses sequence numbers starting at 8000 and the receiving host uses sequence numbers starting at 15000. Sequence numbers are incremented for each octet of data transmitted. Connection establishment messages like SYN and FIN consume a single sequence number but ACK messages do not if no data is carried.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

TCP sequence numbers

Numbering is as follows: Suppose that the first sequence number is 8000, and we are sending 3000 octets of data. In the opposite direction, the first sequence number is 15000 and 2000 octets are to be sent.

8001 8000 8002


SYN

11001

11000
... data ... FIN

Any message not including any of the above do not use any sequence numbers In particular, ACK-only messages, including those sent for connection or disconnection cannot use up sequence numbers.

TCP connection sequence numbers


SYN: carries no data consumes 1 sequence number example: SYN; seq = 8000, ack = 0 SYN + ACK: carries no data consumes 1 sequence number example: SYN + ACK; seq = 15000, ack = 8001 ack increases by 1 to acknowledge SYN in opposite direction. ACK: if no data carried, no sequence number consumed in the forward direction ack increases by 1 to acknowledge SYN in opposite direction. example: ACK; seq = 8000, ack = 15001 First data, from initiating host: seq = 8001 First data, from receiving host: seq = 15001

TCP simultaneous disconnect sequence numbers


FIN: if no data carried, consumes 1 sequence number but carrying data is allowed example (no data): FIN; seq = 11001, ack = 17001 FIN + ACK: carries no data consumes 1 sequence number example: FIN + ACK; seq = 17001, ack = 11002 ack increases by 1 to acknowledge FIN in opposite direction. ACK: no data carried, so no sequence number consumed in the forward direction ack increases by 1 to acknowledge FIN in opposite direction. example: ACK; seq = 11001, ack = 17002

TCP half-close sequence numbers (1)


FIN: if no data carried, consumes 1 sequence number but carrying data is allowed example: FIN; seq = 11001, ack = 16000 ACK: if no data carried, no sequence number consumed in the forward direction therefore, we have to re-use the previous sequence number so that there is no gap in sequence numbers used by data octets ack increases by 1 to acknowledge FIN in opposite direction. example: ACK; seq = 15999, ack = 11002

TCP half-close sequence numbers (2)


Later on, when the other half closes... FIN: if no data carried, consumes 1 sequence number but carrying data is allowed and then example: FIN; seq = 17001, ack = 11002 ACK: if no data carried, no sequence number consumed in the forward direction therefore, we have to re-use the previous sequence number so that there is no gap in sequence numbers used by data octets ack increases by 1 to acknowledge FIN in opposite direction. example: ACK; seq = 11001, ack = 17002

Determine routing table for B

Determine routing table for B


Network [Link] [Link] [Link] Next hop

[Link]
[Link] [Link] [Link]

Determine routing table for B


Network [Link] [Link] [Link] Next hop [Link] [Link] local

[Link]
[Link] [Link] [Link]

local
[Link] local [Link]

Use Bellman-Ford algorithm to find shortest paths from node A


6
B 3 5 A 4 C 5
Node Least cost after stage 1 Least cost after stage 2 Least cost after stage 3 Next hop

D 2

3 1 5

2
1 E

B C D E F

Use Bellman-Ford algorithm to find shortest paths from node A


6
B 3 5 A 4 C 5
Node Least cost after stage 1 Least cost after stage 2 Least cost after stage 3 Next hop

D 2

3 1 5

2
1 E

B C D E F

3 4

10

Use Bellman-Ford algorithm to find shortest paths from node A


6
B 3 5 A 4 C 5
Node Least cost after stage 1 Least cost after stage 2 Least cost after stage 3 Next hop

D 2

3 1 5

2
1 E

B C D E F

3 4

3 4

5
5 8

11

Use Bellman-Ford algorithm to find shortest paths from node A


6
B 3 5 A 4 C 5
Node Least cost after stage 1 Least cost after stage 2 Least cost after stage 3 Next hop

D 2

3 1 5

2
1 E

B C D E F

3 4

3 4

3 4

5
5 8

5
5 6

12

Use Bellman-Ford algorithm to find shortest paths from node A


6
B 3 5 A 4 C 5
Node Least cost after stage 1 Least cost after stage 2 Least cost after stage 3 Next hop

D 2

3 1 5

2
1 E

B C D E F

3 4

3 4

3 4

B C

5
5 8

5
5 6

C
B B

13

Common questions

Powered by AI

TCP sequence numbers during connection initiation begin at a specified number, and both the SYN and SYN+ACK messages each consume one sequence number. For instance, if the initiating host starts with a sequence number of 8000, the first data segment will start at 8001. During termination, FIN messages consume one sequence number whether or not they carry data. For example, a FIN with no data from the initiating host would use sequence number 11001 .

Simultaneous TCP FIN and FIN + ACK transmissions ensure that sequence numbers manage closing the connection orderly. Each FIN consumes a sequence number. The subsequent FIN + ACK also consumes a sequence, acknowledging the partner's FIN. This orderly increment helps both sides of the connection confirm the reception and acknowledgment of closure requests, maintaining synchronization between the two entities .

TCP half-close sequence numbers are used to manage the scenario where one side closes the connection while the other remains open. A FIN from one side consumes one sequence number whether or not data is present. The ACK that follows does not consume a sequence number, instead reusing the previous number to avoid gaps. This ensures continuity, as the next ACK or FIN increments the acknowledgment number by one to acknowledge the receipt of a FIN in the opposite direction .

Ensuring no gaps in sequence numbers for TCP data segments is crucial for maintaining data integrity and orderly transfer, particularly in half-close operations. Reusing previous sequence numbers ensures that the receiving end correctly tracks the data stream continuity, preventing potential errors or transmission issues. This strategy is essential for maintaining operational coherence and data accuracy during transmission and closure of connections .

The Bellman-Ford algorithm calculates shortest paths by iteratively relaxing the edges, updating the path cost for each node until no further minimization is possible. From node A, after stage one, nodes B and C had the costs of 3 and 4, respectively. By stage three, the costs were B: 3, C: 4, D: 5, E: 5, and F: 6. The next hops were determined as B for nodes B and F, C for D, and B for E after three stages .

Simultaneous disconnect in TCP involves both sides sending FIN messages that consume sequence numbers regardless of whether data is included. An example case without data could involve a FIN from host A with seq = 11001 and ack = 17001. The responding host B would send "FIN + ACK; seq = 17001, ack = 11002," indicating acknowledgment and closing its side. The ACK from the initial host then increments the acknowledgment number by one to confirm the receipt of the final FIN .

Key considerations affecting the determination of next hops in a routing table using the Bellman-Ford algorithm include the current cost from the source node, potential paths through neighboring nodes, network topology, and edge weights. The algorithm systematically evaluates each node's cumulative cost, adjusting routes to reflect the lowest known cost progressively, ensuring that the chosen paths remain optimal and adjusted for dynamic changes in network conditions .

When TCP processes ACK messages that do not carry any data, they do not consume any sequence numbers in the forward direction. However, the ACK number increases by one to acknowledge the data or FIN received in the opposite direction. Specifically, a message such as "ACK; seq = 8000, ack = 15001" indicates acknowledgment of a SYN from the other host .

In a TCP connection without data, a sequence number is first assigned to the SYN packet. Upon reply, a SYN + ACK consumes another sequence number to acknowledge the original SYN. When a FIN is later sent without carrying data, it once again consumes a sequence number. Thus, the sequence evolves by incrementing for each SYN and FIN, highlighting their individual roles in connection management .

The Bellman-Ford algorithm iterates through all edges, progressively updating the shortest path estimates to each node. Initially, direct neighbors of the source node have their path costs updated. Subsequent iterations refine these estimates by considering more nodes and alternative paths, leading to eventual convergence on the shortest paths. Each pass provides more complete information, ensuring that indirect routes are considered and optimal paths are finally confirmed .

You might also like