# Transmission Control Protocol Simulator
(Peer-Peer)

## Protocol Description

TCP (Transmission Control Protocol) is a connection-oriented protocol for transferring data reliably in either direction between a pair of users. TCP is described in Sections 6.4.1 to 6.4.5 of [Tanenbaum 1996]. TCP is a rather complex protocol, so it is easy to lose track of the simulation. Try not to do anything too complicated! complicated! There is a client-server version as an alternative to this peer-peer simulation.

The protocol simulation shows a time-sequence diagram with two peer service users, protocol entities A and B that support them, and a communications medium that carries messages. Either peer actively opens a connection, to which the other peer responds. After a connection has been made, the two peers may send data messages to each other.

Users simply send messages of a fixed size; the content of messages is not identified. Depending on the medium maximum packet size, messages may be sent as a number of fragments. Data transfer is also subject to the current window size of the receiver, and may be held up if the receiver's window becomes full.

To open a connection, a message is sent with the SYN flag. To close a connection, a message is sent with the FIN flag. Urgent messages may also be sent by selecting the PUSH flag as a protocol parameter.

Messages may contain a send sequence number (the offset of where the message starts in the user's byte stream), an acknowledgement sequence number (the offset of the next byte expected), and the current window (how many bytes can be received).

TCP is rather complex, so the simulation does not attempt to faithfully reflect all its details. Although the main paths should work as expected, it is possible to get the simulation into unusual states in which it does not behave correctly.

## Protocol Simulation Parameters

User A Message Size |  | User A Push Flag |  | Protocol A Receive Window |
User B Message Size |  | User B Push Flag |  | Protocol B Receive Window |
Medium Maximum Packet Size |  |  |