UDP and TCP

¡Supera tus tareas y exámenes ahora con Quizwiz!

TCP connection setup

A and B must agree on set of initial parameters - Set up an initial sequence number • This is chosen randomly - uniquely identifies the setup • Why not start with sequence number 0 always? - Answer: this guards against two incarnations of the same connection reusing the same sequence #'s too soon (see later slides & textbook) - Also, a setup() followed by a delayed setup() (both lacking initial sequence #'s) could be mistaken for a request for a new connection 18 • TCP uses a 3-way handshake - Three-way handshake allows for unambiguous setup/ teardown even under conditions of • Loss • Duplication • Delay

two-way handshake

handles duplicate requests with timeout: connection already established handles stale accepts: ignore problems with stale data/setups if connection connects correctly but timeout happens and the client resends it but it comes after the host has already finished with the connection then it reconnects with the same data: timer solution: but this fails because of the amount of states the host needs to keep track of. timestamps: relies on global accurate clocks SOLUTION 3 WAY HANDSHAKE

TCP Header

• 20 bytes • Source port for TCP sending process • Dest port for TCP receiving process • 32-bit Sequence # (host is sender) • 32-bit ACK # (host is receiver ACK'ing data sent by other endpoint) • Flow control window size: Receiver advertises how many bytes it is willing to accept into its buffer • Checksum: computed over TCP header + payload + prepended IP pseudoheader (similar to the one that UDP uses) • Urgent Pointer points to where there is emergency data in payload - not used much • Variable-sized (not just 20 bytes), can have Options after the Urgent Pointer field • Signalled in Flags field • Most common option: Maximum Segment Size (MSS) exchanged during setup

Three-way handshake

• Both sender and receiver choose unique random ID's to label their (x,y) connection • x chosen by Sender, y by receiver • Prevents Failure scenario for old data/setups

UDP Multiplexing/Demultiplexing

• IP layer inspects Protocol field = UDP • Sends to buffer of waiting UDP process with matching port #

TCP Client/Server Connection State

• Now, TCP has created a connection between 2 endpoints. • TCP maintains a Transmission Control Block (TCB) per connection at each endpoint • State of connection • Macro: current state in state transition diagram • Micro: RTT, congestion window size, ... • Buffers: pointers to send and receive buffers • A TCP connection/session/socket buffer is uniquely named with a 4-tuple • <source IP, source port, dest IP, dest port> • In UDP, socket buffer named only by <dest IP, dest port> • Implication is that creating a server to listen on port P, then... • Two UDP clients connecting to P will send to the same socket buffer • Two TCP clients connecting to P will send to separate socket buffers

• Why TCP, when data-link layer protocols can provide hop by hop reliability?

• Packets can be lost due to overflow in an intermediate node • Packets can be lost due to failure of intermediate nodes, who may be holding packets • Not all link-layer protocols may provide retransmission

TCP features?

• Reliable in-order service • At some cost in delay • Flow control • Congestion control • Connection setup • Connection state machine • Achieves reliability by: • Retransmission of a segment after a timeout or duplicate ACK • Sliding window with sequence #'s

TCP: Transmission Control Protocol - Reliable Delivery

• TCP is a transport protocol on top of IP that provides: 1. Reliable delivery of packets, AND 2. Stream or in-order delivery 3. Also, full-duplex service

UDP Features?

• Transport protocol above IP • simply passes IP through to the upper (application) layers • Gives app's the option to send packets unreliably • Useful for multicast app's • Low delay transmission for interactive text/audio/ video • Minimal connection setup time • Minimal connection state: "connectionless" • No congestion control - blast away • Build own application-level protocol on top of UDP

UDP header

• UDP Header: • Only 8 bytes! (vs. IPv4 20 bytes header) • Source port for UDP sending process • Dest port for UDP receiving process • Length in bytes of UDP header + payload • Checksum over IP pseudo-hdr + UDP header + payload

What is UDP and what are the consequences of it?

User Datagram Protocol (UDP) provides best effort unreliable datagram delivery on top of IP • Packets may be lost • Due to congestion • In routers • At receiver and/or sender • Due to fading • Packets may be reordered • Packets may be duplicated


Conjuntos de estudio relacionados

ELIE WIESEL'S REMARKS AT THE DEDICATION OF YAD VASHEM HOLOCAUST HISTORY MUSEUM

View Set

Chapter 14: Capitalism and Economy - Inquisitive Questions

View Set

Sociology of Del. Youth - Exam 2

View Set

Restorative Art - Muscles of Form and Expression test 2

View Set

English II Unit 7 - Bias, Media, and Persuasion

View Set