slides21 Flashcards
who came first tcp or udp
tcp
header of udp
16 bit source port
16 bit destination port
16 bit UDP length
16 bit UDP checksum
is checksum important in UDP
no, unreliable so fine
how does udp compare with other headers
much slimmer
where is udp useful
single request and reply
Where a fast response is required
Where speed is more important than accuracy
what is the procedure when a udp is lost
up to application
tcp challenge
create reliability over unreliability
what is ACK
The basis of the reliability is the use of acknowledgement (ACK) packets for every packet sent
If host A sends host B a packet, B must send an ACK packet back to A to inform it of the safe arrival of the packet
If A does not get an ACK, it resends the packet
Two Armies Problem
infinite exchange of acks
TCP avoids the Two Armies Problem by using timeouts and packet retransmissions
Problems to solve with acks
how long to wait before a resend?
how many times to resend before giving up? how long B should wait before sending the ACK?
IP datagrams can arrive out of order
Problems to solve with tcp
how to maintain order in the data
how to manage duplicates
flow control
TCP packets are often called…
segments
what are the most important headers of tcp
sequence and acknowledgement 32bits each
given Every byte in a TCP connection is numbered, how is data “counted”
The 32 bit sequence number starts at some random value and increases by 1 for each byte sent
So if a segment contains 10 bytes of data, the sequence number on the next segment sent will be 10 greater
how does tcp implement full duplex
by keeping independent sequence numbers and flow control
Acknowledgment number
Acknowledgment number (32 bits) If the ACK flag is set then the value of this field is the next sequence number that the sender of the ACK is expecting. This acknowledges receipt of all prior bytes (if any). The first ACK sent by each end acknowledges the other end's initial sequence number itself, but no data.
Sequence number
Sequence number (32 bits)
Has a dual role:
If the SYN flag is set (1), then this is the initial sequence number. The sequence number of the actual first data byte and the acknowledged number in the corresponding ACK are then this sequence number plus 1.
If the SYN flag is clear (0), then this is the accumulated sequence number of the first data byte of this segment for the current session.
what is an obstacle to TCP
fragmentation
In this case TCP must wait for all the fragments and reconstruct the segment before it can send the ACK
give an example of the ack number chosen by the receiver after having received some data
The returning ACK field contains the sequence number of the next byte the destination expects to receive, e.g., if the sequence number is 20000 and 14 bytes are received it returns 20015 in the ACK field
PAWS and tcp
PAWS uses the same TCP Timestamps option as the RTTM mechanism described earlier, and assumes that every received TCP segment (including data and ACK segments) contains a timestamp SEG.TSval whose values are monotone non-decreasing in time. The basic idea is that a segment can be discarded as an old duplicate if it is received with a timestamp SEG.TSval less than some timestamp recently received on this connection.
list all tcp flags
- URG: urgent data
- ACK: the acknowledgement field is active
- PSH: push this data to the application as fast as possible • RST: reset (break) the connection
- SYN: synchronise a new connection
- FIN: finish a connection
- ECE: congestion notification
- CWR: congestion window reduced
- 4 reserved bits, set to 0