sender algorithm

advertisement
Discussion Notes (TCP and project 2)
EE122 Communication Networks, Fall '04
1. TCP
Based IP protocol, TCP adds port number for data multiplexing, provides in-order, reliable delivery
service model. TCP also supports flow control and congestion control, and is a well paced
transportation protocol.
1.1 Establish a connection: 3-way hand shake
1.2 Tear down the connection
1. Both sides of the connection must independently close its half of the connection; otherwise it means
it has no more data to send, but it is still available to receiver data from the other side.
2. Three combinations of transitions
a) This side closes first:
ESTABLISHED  FIN_WAIT1  FIN_WAIT2  TIME_WAIT  CLOSED
b) The other side closes first:
ESTABLISHED  CLOSE_WAIT  LAST_ACK  CLOSED
c) Both sides close at the same time:
ESTABLISHED  FIN_WAIT1  CLOSING  TIME_WAIT  CLOSED
c) The TIME_WAIT state cannot move to the CLOSED state until it has waited for two times the
maximum amount of time an IP datagram might live in the Internet (120 second). If not, then another
pair of application processes might come along and open the same connection (i.e. use the same pair of
port numbers), and the delayed FIN segments from the earlier incarnation of the connection would
immediately initiate the termination of the later incarnation of that connection.
FIN_WAIT1
FIN_WAIT1
2
TIME_WAIT
CLOSE_WAIT
1.3 Sliding windows Algorithm
LBA
LBS
Seq. # increase
LBA: Last Byte Acked;
LBS: Last Byte Sent;
SWS: the upper bound on the # of outstanding frames that the sender can transmit.
Sliding window on sender: LBS – LBA <= SWS
LAB
LBR
Seq. # increase
LAB: Largest Acceptable Byte;
LBR: Last Byte Received
SWS: the upper bound on the # of outstanding frames that the receiver is willing to accept.
Sliding window on sender: LBR – LAB <= RWS
1. The goal
a) Reliable transmission: seq. number + acknowledge + retransmission
b) In-order delivery: acknowledge
c) Flow control: Advertised Window
2. The algorithm
At the sender:
1) Associates each frame (packet) with a seq. # and a timer.
2) An arriving of an ACK moves LAR to the right at sender.
3) When a timer expires before the ACK arrives for this packet, the sender retransmits the packet.
4) By controlling SWS, one can control the sending rate of the sender.
At the receiver, when a frame with SeqNum arrives:
1) If SeqNum <= LFR, or SeqNum > LAF, it is outside the receiver windows and is discarded.
2) If LFR < SeqNum <= LAF, it is inside window and is accepted.
3) It then sends an ACK with cumulative acknowledgement. It acks SeqNumToAck, the largest
sequence number not yet acknowledged, such that all frames with sequence numbers less than or equal
to it have been received.
4) To support flow control, the receiver keeping informing the sender of how many bytes in has room
to receiver (Advertised Window).
1.4 TCP Flow control
Receiver sends an AdvertisedWindow to sender to control how fast the sender can send out data. The
algorithm works as follows.
2. Project 2
2. 1 Different flavor of TCP on congestion control
There are TCP Tahoe, Reno, Vegas, SACK, etc. In project 2, a set of black boxes are given. You need
to design and run simulation to tell which box has which implementation.
2.2 Introduction to NS2
See the introductory slides for NS2.
Download