Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP9003 Assignment
3. Assignment Specification
STP should be implemented as two separate programs: sender and receiver. You should implement
unidirectional transfer of data from the sender to the receiver. As illustrated in Figure 1, data
segments will flow from sender to receiver while ACK segments will flow from receiver to sender.
The sender and receiver programs will be run from different terminals on the same machine, so you
can use localhost, i.e., 127.0.0.1 as the IP address for the sender and receiver in your program. Let
us reiterate this, STP must be implemented on top of UDP. Do not use TCP sockets. If you use
TCP, you will not receive any marks for your assignment.
You will find it useful to review Sections 3.5.4 - 3.5.6 of the text (or the relevant parts from the
Week 5 lecture notes). It may also be useful to review the basic concepts of reliable data transfer
from Section 3.4 (or relevant parts from the Week 4 lecture notes). Section 3.5 of the textbook
which covers the bulk of the discussion on TCP is available to download on the assignment page.
3.3 State Diagram
The asymmetry between sender and receiver leads to somewhat different state diagrams for the two
endpoints. The state diagram for STP is shown below, which depicts the normal behaviour for both
end points.
Figure 2: State diagram depicting the normal behaviour of STP.
The receiver can be in four possible states: CLOSED, LISTEN, ESTABLISHED and TIME_WAIT.
Initially, it is in the CLOSED state. Upon issuing a passive open, it enters the LISTEN state. Note
that the receiver is the passive host in our protocol and is initiated first, while the sender is initiated
next and actively opens the connection. While in the LISTEN state, the receiver waits for a SYN
segment to arrive on the correct port number. When it does, it responds with an ACK, and moves to
the ESTABLISHED state. Should a duplicate SYN arrive while the receiver is in the
ESTABLISHED state, it reissues the ACK and remains in the ESTABLISHED state. The ACKs
sent by the receiver are cumulative (like TCP). After the sender has reliably transmitted all data 6
(and received acknowledgments), it will send a FIN segment to the receiver. Upon receipt of the
FIN, the receiver moves to the TIME_WAIT state. As in TCP, it remains in TIME_WAIT for two
maximum segment lifetimes (MSLs) before re-entering the CLOSED state. This is to ensure that
the receiver can respond to potentially retransmitted FIN segments from the sender. You may
assume that the MSL is 1 seconds. In other words, the receiver should remain in TIME_WAIT for 2
seconds and then transition to CLOSED.