Transport Layer and UDP Notes
Introduction to Computer Networks
TCP/IP Protocol Stack
Layers:
- Ethernet
- WIFI
- IP
- UDP
- TCP
- FTP
- HTTP
- TFTP
- DNS
Protocols:
- FTP: File Transfer Protocol
- HTTP: Hypertext Transfer Protocol
- TFTP: Trivial File Transfer Protocol
- DNS: Domain Name System
- TCP: Transmission Control Protocol
- UDP: User Datagram Protocol
- IP: Internet Protocol
Processes and Ports
- IP Addresses: Operate at the network level, routing data between hosts.
- Port Numbers: Operate at the transport level, directing data to specific processes within a host.
- Analogy: IP addresses are like street addresses, while port numbers are like apartment numbers within a building.
- Communication: Enables host-to-host (IP) and process-to-process (UDP) communication.
Sockets
- Socket Address: Defined by the tuple
. - Uniqueness: This tuple uniquely identifies the "pipe" or connection between processes.
Well-Known Ports
- 7: Echo (Echoes a received datagram back to the sender)
- 9: Discard (Discards any received datagram)
- 11: Users (Active users)
- 13: Daytime (Returns the date and time)
- 17: Quote (Returns a quote of the day)
- 19: Chargen (Returns a string of characters)
- 20: FTP, Data (File Transfer Protocol - data connection)
- 21: FTP, Control (File Transfer Protocol - control connection)
- 23: TELNET (Terminal Network)
- 25: SMTP (Simple Mail Transfer Protocol)
- 53: DNS (Domain Name Server)
- 67: BOOTP (Bootstrap Protocol)
- 79: Finger (Finger)
- 80: HTTP (Hypertext Transfer Protocol)
- 111: Port mapper (Port mapper)
Process-to-Process Protocols
- Responsibility: Realization of process-to-process packet delivery.
- Expectations:
- Guaranteed message delivery (end-to-end).
- Ordered delivery.
- Rejection of duplicate messages.
- Messages of arbitrary length.
- Congestion control to handle network overloading.
Need for Transport Layer
- Limitations of Network Layer:
- Can drop messages (due to buffer overflow, etc.).
- Can reorder messages.
- Deliver duplicate copies.
- Limits message size.
- Function: The transport layer addresses these limitations by providing end-to-end transport service to the application layer.
Internet Transport Protocols
- UDP: User Datagram Protocol
- Datagram messaging service.
- "Best-effort" IP end-to-end service.
- TCP: Transmission Control Protocol
- Reliable, in-order delivery.
- Connection set-up.
- Discarding of corrupted packets.
- Retransmission of lost packets.
- Flow control.
- Congestion control.
- RPC: Remote Procedure Call
- Request/Reply Service.
- Execute a program in a remote host.
User Datagram Protocol (UDP)
- Simplest connectionless transport protocol.
- Functionality:
- Multiplexing and de-multiplexing of flows.
- UDP checksum for error detection.
- Unreliable delivery of packets.
Multiplexing and De-multiplexing
- Multiplexing: Multiple processes on a host generate messages for the same or different hosts, which are then multiplexed by the transport layer.
- De-multiplexing: Reassembling messages at the receiving host and passing them to the appropriate processes.
Encapsulation Process
- Encapsulation: Process -> Message -> UDP header -> UDP data -> IP header -> IP data -> Frame header -> Frame data
- Decapsulation: Reverse process at the receiving end.
UDP Communication Service
- Process Identification: Processes are identified based on ports (sockets).
- Port Range: 16 bits per port field allows for 64K (2^16) different identifiers.
- De-multiplexing:
UDP Message Queue
- Ports and Queues: Each application process has a queue associated with a specific port.
- Packet Arrival: Packets arrive and are de-multiplexed to the appropriate application process queue.
Port Discovery
- Well-Publicized Ports: Standard ports for services (e.g., DNS uses port 53, Email uses port 25, HTTP uses port 80).
- Port-Mapper Service: Use a well-known port (e.g., 111) as a "port-mapper" to dynamically discover ports for other services, similar to a directory assistance service.
Advantages of UDP
- Real-Time Traffic: Control over data sending; no connection establishment delay.
- Stateless Connection: Easier to handle many active clients due to no allocation of buffers, sequence numbers, etc.
- Small Header: UDP header is only eight-bytes long.
Disadvantages of UDP
- "Best Effort" Networking: No guaranteed delivery, ordered delivery, or congestion control.
- Congestion Issues: UDP does not adapt to network congestion and can suppress TCP flows.
- Attack Vector: Susceptible to UDP flooding attacks.
Applications Utilizing UDP
- Simple Query Protocols: DNS benefits from low overhead and quick retransmission.
- Multimedia Applications: Real-time applications like telephone calls, video conferencing, and gaming can tolerate some packet loss.