Understanding Network Protocols and Architectures
Network Protocols and Architectures
Transport Services and Protocols
Transport services and protocols provide communication between application processes running on different hosts.
- Send side: Breaks application messages into segments and passes them to the network layer.
- Receive side: Reassembles segments into messages and passes them to the application layer.
Network and Transport Layers
Network layer: Enables logical communication between hosts.
Transport layer: Facilitates local communication between processes, relying on and enhancing network layer services.
TCP (Transmission Control Protocol)
TCP provides:
- Congestion control
- Flow control
- Connection setup
Multiplexing and Demultiplexing
Multiplexing (sender): Handles data from multiple sockets and adds a transport header.
Demultiplexing (receiver): Uses header information to deliver received segments to the correct socket.
How Demultiplexing Works:
- The host receives datagrams.
- The host uses IP addresses and ports to direct the segment to the appropriate socket.
- Each created socket has a host-local port.
- When creating a datagram to send into a UDP socket, the IP and port must be specified.
Connection-Oriented Demultiplexing
A TCP socket is identified by a 4-tuple:
- Source IP
- Source Port
- Destination IP
- Destination Port
Demultiplexing: The receiver uses all four values to direct the segment to the appropriate socket. A server host may support many TCP sockets.
UDP (User Datagram Protocol)
UDP is a connectionless protocol with no handshaking between the sender and receiver. Each UDP segment is handled independently.
Why Use UDP?
- No connection establishment
- Simple: No connection state at the sender or receiver
- Small header size
Reliable Data Transfer
Considers only unidirectional data transfer (flow in both directions). Uses a Finite State Machine (FSM) to specify the sender and receiver.
Peer-to-Peer (P2P) Architecture
In a P2P architecture, arbitrary end systems communicate directly. Peers request services from and provide services to other peers.
Self-scalability: New peers bring new service capacity.
Processes and Sockets
Process: A program running within a host.
Client process: The process that initiates communication.
Server process: The process that waits to be contacted.
Sockets: The endpoints through which processes send and receive messages.
Identifier: Used to receive messages. Includes both IP address and port number.
Application Layer Protocols
Application-layer protocols define:
- Types of messages exchanged
- Message syntax
- Message semantics
- Rules for communication
Transport Services
Transport services provide:
- Data integrity
- Timing
- Throughput
- Security
TCP Service
TCP service offers:
- Reliable transport
- Flow control
- Congestion control
TCP service does not provide:
- Timing guarantees
- Minimum throughput guarantee
TCP is connection-oriented.
UDP Service
UDP service provides unreliable data transfer and does not offer the features of TCP.
HTTP (Hypertext Transfer Protocol)
HTTP typically uses TCP. The client initiates a TCP connection to the server, the server accepts the connection, HTTP messages are exchanged, and then the TCP connection is closed.
HTTP is “stateless” – the server maintains no information about past client requests.
RTT (Round-Trip Time): The time for a small packet to travel from the client to the server and back.
HTTP response time (non-persistent): One RTT to initiate the TCP connection.
HTTP (persistent): Requires 2 RTTs per object.
HTTP Methods
POST method: Often used for web forms. Input is uploaded to the server.
GET method: Used to retrieve data. The whole path can be bookmarked.
Cookies
Cookies are used for:
- Authorization
- Shopping carts
- Recommendations
Maintaining State
How to keep state:
- Protocol endpoints maintain state at the sender and receiver over multiple transactions.
- HTTP messages carry state.
Web Caches
Web caches satisfy client requests without involving the origin server, reducing response time to the client.
SMTP (Simple Mail Transfer Protocol)
SMTP uses persistent connections and requires messages to be in 7-bit ASCII format.
Comparison to HTTP
- HTTP: Pull-based (client requests data)
- SMTP: Push-based (server sends data)
- Both use ASCII command/response format
- HTTP: Each object is encapsulated in its own response message
- SMTP: Multiple objects can be sent in a multipart message
Domain Name System (DNS)
The Domain Name System (DNS) is a distributed database implemented in a hierarchy of many name servers. It’s an application layer protocol that allows hosts and name servers to communicate to resolve names.
Packet Switching
Packet switching: Hosts break application-layer messages into packets.
Store and forward: The entire packet must arrive at a router before it can be transmitted on the next link.
Queuing and loss: Occurs if the arrival rate (bits) to a link exceeds the transmission rate of the link for a period of time.
Routing and Forwarding
Routing: Determines the source-destination route taken by packets.
Forwarding: Moves packets from a router’s input to the appropriate router output.
Packet Loss
Packet loss: Occurs when a queue (buffer) preceding a link is full and a packet arriving at the full queue is dropped.
Throughput
Throughput: The rate (bits per time unit) at which bits are transferred between sender and receiver.
Instantaneous throughput: The rate at a given point in time.
Why Layering?
Layering provides several benefits:
- Explicit structure allows for the identification and understanding of the relationships between the complex system’s pieces.
- Modularization eases maintenance and updating of the system.
Internet Protocol Stack
The Internet Protocol Stack consists of five layers:
- Application: Supports network applications (e.g., HTTP, SMTP, DNS)
- Transport: Provides process-to-process data transfer (e.g., TCP, UDP)
- Network: Handles routing of datagrams from source to destination (e.g., IP)
- Link: Manages data transfer between neighboring network elements (e.g., Ethernet, Wi-Fi)
- Physical: Transmits bits on the wire
Additional Layers (Not Part of the Internet Protocol Stack)
Presentation: Allows applications to interpret the meaning of data.
Session: Provides synchronization, checkpointing, and recovery of data exchange.
Communication
Peers assume that they are communicating horizontally within the same layer.