Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views5 pages

Networking Fundamentals4

Uploaded by

xxxxxxxxxxxxxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Networking Fundamentals4

Uploaded by

xxxxxxxxxxxxxx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Networking Fundamentals - Class Notes

Course: CS 101 - Introduction to Networking

Instructor: Prof. Davis

Date: November 2, 2023

Topic: Transport Layer Deep Dive - TCP & UDP

1. The Role of the Transport Layer (Layer 4)

Primary Goal: Provide logical communication between application


processes running on different hosts.

Key Responsibilities:

Process-to-Process Delivery: Using port numbers to multiplex/demultiplex


data to the correct application.

Connection Management (TCP): Establishing and terminating sessions.

Reliability (TCP): Ensuring data arrives completely and correctly.

Flow Control: Managing the rate of data transmission to prevent


overwhelming the receiver.

Congestion Control: Managing the rate of data transmission to prevent


overwhelming the network.

2. Socket Address: The Full Destination

A network communication is defined by a combination of two addresses:

Socket Address = IP Address + Port Number

Example: 192.168.1.100:80 -> The web server process on a specific host.


3. TCP (Transmission Control Protocol) - The Reliable Protocol

Core Characteristics: Connection-oriented, reliable, byte-stream delivery.

A. The TCP Segment Header (Key Fields)

Field Purpose

Source Port The port number of the sending application.

Destination Port The port number of the target application.

Sequence Number Identifies the byte order of the data sent.

Acknowledgment Number Confirms receipt of data; tells sender the


next byte expected.

Control Flags SYN - Synchronize (Initiate connection)

ACK - Acknowledgment

FIN - Finish (Terminate connection)

RST - Reset (Abort connection)

PSH - Push (Send data immediately)

URG - Urgent

Window Size Advertises the receiver's available buffer space for Flow
Control.

B. The TCP Connection Lifecycle

Connection Establishment - Three-Way Handshake

Client --> Server: SYN (Seq = x)

Server --> Client: SYN-ACK (Seq = y, Ack = x+1)

Client --> Server: ACK (Seq = x+1, Ack = y+1)


Connection is now established. Data can be transferred.

Data Transfer (with Reliability)

Acknowledgment: For every segment (or group of segments) received, the


sender must get an ACK packet back.

Retransmission Timer: If an ACK is not received before the timer expires,


the sender assumes the segment was lost and retransmits it.

Connection Termination - Four-Way Handshake

Client --> Server: FIN (Seq = x)

Server --> Client: ACK (Ack = x+1)

Server --> Client: FIN (Seq = y)

Client --> Server: ACK (Ack = y+1)

Connection is now fully closed.

C. Flow Control vs. Congestion Control

Feature Flow Control Congestion Control

Purpose Prevent the receiver from being overwhelmed. Prevent the


network from being overwhelmed.

Mechanism Receiver Window (rwnd). The receiver advertises its free


buffer space in the TCP header. The sender cannot send more data than
the window allows. Congestion Window (cwnd). The sender's estimate
of how much data the network can handle. Dynamically adjusted based on
packet loss (the main signal of congestion).

Who it Protects The Receiving Host The Network Infrastructure


(routers, links)

The sender's actual sending window is the minimum of the receiver's


window (rwnd) and the congestion window (cwnd).

4. UDP (User Datagram Protocol) - The Simple Protocol

Core Characteristics: Connectionless, unreliable, message-based delivery.

The UDP Datagram Header

Only 4 fields: Source Port, Destination Port, Length, Checksum.

No sequence numbers, acknowledgment numbers, or flags.

No handshaking for connection setup/teardown.

When to Use UDP:

Speed is Critical: Real-time applications can't afford retransmission delays


(e.g., VoIP, live video streaming, online games). A lost packet is simply
skipped.

Simple Query/Response: DNS lookups. The request is small, and if the


response is lost, the client can just retry the query.

Protocol Efficiency: Protocols like DHCP and TFTP are built on UDP for
simplicity and low overhead.

Multicast/Broadcast: TCP only handles one-to-one (unicast)


communication. UDP can send to multiple hosts.
5. TCP vs. UDP Summary Table

Feature TCP UDP

Connection Connection-oriented Connectionless

Reliability Reliable (ACKs, Retransmissions) Unreliable (Best-effort


delivery)

Ordering Guaranteed in-order delivery No ordering guarantees

Overhead High (header size, control traffic) Very Low (8-byte header)

Speed Slower due to handshakes & control Faster

Data Flow Byte stream Message (datagram) boundaries preserved

Use Cases Web, Email, File Transfers Video, Voice, DNS, Games

Key Takeaway: The choice between TCP and UDP is a fundamental design
decision. **Choose TCP for reliability and data integrity. Choose UDP for
speed, simplicity, and real-time applications where timeliness is more
important than perfect data

You might also like