csnotes/311/lec/lec10.md
2019-09-24 11:34:35 -07:00

2.3 KiB

lec10

TCP Structue

Sequence Numbers:

  • byte stream number of first byte in segment's data

ACKS's:

  • seq # of next byte expected from other side

Example:

host a: user sends 'c'
	seq=42, ack=79, data='c'
host b: ACK recepit send to host a(echo's back ''c')
	seq=72, ack=49, data='c'	; data sent back from host b

Round trip time

EstimatedRTT= (1-\alpha)EstimatedRTT + \alphaSampleRTT

Lot's of stuff missing here

TCP Reliable data transfer

Implements:

  • Pipeplined segments
  • cumulative ACK
    • This just means that we assume that the highest sequenced ACK also means the previous segments have been received properly too
  • Single transmission timer

Sender Events

  1. First create segment w/ seq no.

    a. Sequence number refers to byte in

  2. Start timer if we don't already have one.

    a. Timer based off oldest UN-ACKED segment

Retransmission w/ TCP

Timout: Usually it's pretty long so if there is a timeout on a packet. When this happens the receiver responds to sender with 3 ACK's for the last well received segment:

Receiver gets 1 2 3 5 but not 4. We respond with the ACK for 1 like normal, then 3 ACK's for 1 is sent to the sender before the time out and we start re-sending from 2. This is what we call fast retransmit.

The main thing here is that the receiver controls the sender's "send rate" so that the receiver doesn't get inundated. Receiver will advertise free buffer space in including rwnd value in TCP header. This just tells the sender how much space is available to accept at a time.

Example: Transferring a large file from host to host.

\alpha will send a file to \beta. Alpha sends some file data to \beta, who then ACK's the packet but includes in the header that their buffer is full. \alpha responds with a 1 byte packet to keep the connection alive.

Connection Management

Before sender/receiver start exchanging anything we must perform a handshake. SYN is a special packet type under TCP which we can use to synchronize both client and server.

Closing

FIN bit inside the header. We send this off to a receiver and we enter a close_wait state. We only wait because there might be more data. Receiver enters the close_wait state as well, but, still sends any data left over. Once the last ACK is sent we send a FIN packet