Protocols Flashcards
What is a protocol?
A protocol is a set of rules that allow two or more entities(computers) to communicate and transfer data. It ensures that the data is transmitted accurately and can be understood by both the sender and the receiver.
List five protocols
- TCP (transmission control protocol)
- UDP (user datagram protocol)
- HTTP (hyper text transfer protocol)
- gRPC (gRPC Remote Procedure Calls)
- FTP (File Transfer Protocol)
List three text-based data formats
- Plain text: Human-readable and easy to debug, but less efficient.
- JSON (JavaScript Object Notation): Lightweight data-interchange format that’s easy for humans to read and write.
- XML (eXtensible Markup Language): Flexible, but more verbose than JSON.
List three binary-based data formats
- Protobuf (Protocol Buffers): Efficient and extensible binary serialization format developed by Google.
- RESP (REdis Serialization Protocol): Used by Redis, a simple and efficient format for communication between clients and servers.
- h2, h3: HTTP/2 and HTTP/3 protocols that use binary framing for better performance.
What are the two main transfer modes in networking protocols and give an example of each?
The two main transfer modes are:
Message-based (Example: UDP - sends discrete datagrams)
Stream-based (Example: TCP - provides continuous stream of data)
What are the three main types of addressing systems used in networking?
The three main addressing systems are:
DNS (Domain Name System) - Human-readable addresses
IP (Internet Protocol) - Unique numerical labels for devices
MAC (Media Access Control) - Unique identifiers for network interfaces
Explain the difference between full duplex and half duplex communication.
Full duplex allows communication to occur simultaneously in both directions, while half duplex allows communication in both directions but not simultaneously.
What is the key difference between stateful and stateless protocols? Give an example of each.
Stateful protocols maintain a connection state throughout the communication session (example: TCP), while stateless protocols treat each message independently with no connection state maintained (example: UDP, HTTP).
What is the difference between TCP and UDP in terms of flow and congestion control?
TCP implements both flow control (managing data transmission rate) and congestion control (avoiding network congestion), while UDP has neither, making it faster but less reliable.
What are the two main methods of error management in networking protocols?
The two main methods are:
Error codes (standardized codes indicating different types of errors, like HTTP 404)
Retries and timeouts (mechanisms to handle errors by retrying transmission or aborting after a period)
What is the primary difference between HTTP and TCP in terms of directionality?
HTTP is typically unidirectional, involving a client sending a request and a server responding one way at a time, while TCP is bidirectional, allowing simultaneous data transmission in both directions.
What are the three main reasons why we need a communication model?
Agnostic Applications: Allows applications to work independently of network technology
Network Equipment Management: Enables standardized operation of various network devices
Decoupled Innovation: Permits independent innovation within different layers without affecting others
What is an agnostic application and why is it important?
An agnostic application is one that doesn’t need to know the specifics of the network medium it’s using. This is important because it:
Eliminates the need for separate versions for different network mediums
Simplifies application development
Increases compatibility and flexibility
What is the OSI Model and how many layers does it have?
The OSI (Open Systems Interconnection) model is a conceptual framework that divides network communications into seven distinct layers, each describing a specific aspect of networking. It’s used to understand and implement network communications.
What are the 7 layers of the OSI model in order from top to bottom?
Application Layer
Presentation Layer
Session Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
What is the main function of the Transport Layer (Layer 4) and what are its key protocols?
The Transport Layer provides reliable data transfer services to upper layers. Its key protocols are:
TCP (Transmission Control Protocol) for reliable, connection-oriented transmission
UDP (User Datagram Protocol) for connectionless transmission
It ensures complete data transfer through error checking, flow control, and data retransmission.
What is the role of the Physical Layer (Layer 1)?
The Physical Layer transmits raw bit streams over physical medium by:
Handling physical connection setup, maintenance, and teardown
Converting data into electrical, optical, or radio signals
Managing modulation and demodulation of signals
Examples include copper wires, fiber optics, and radio waves.
What is the main difference between the Data Link Layer and the Network Layer?
The Data Link Layer (Layer 2) provides node-to-node data transfer and handles error correction using MAC addressing and framing, while the Network Layer (Layer 3) manages device addressing and routing across network boundaries using IP protocols.
What are the main functions of the Presentation Layer (Layer 6)?
The Presentation Layer transforms data into a format that the application layer can accept by:
Handling encoding and encryption
Managing data compression
Performing data serialization (e.g., converting to JSON or XML)
Ensuring data is readable and translatable between different systems
How does a POST request flow DOWN through the OSI model from sender to network? Describe the process at each layer.
Starting from top to bottom:
Application Layer (L7): Creates the POST request with HTTP headers, method, and data
Presentation Layer (L6): Formats the data (e.g., converts to JSON), may encrypt if using HTTPS
Session Layer (L5): Establishes and manages the session, may handle authentication
Transport Layer (L4): Breaks data into segments, adds TCP header with port numbers
Network Layer (L3): Adds IP headers with source/destination IP addresses, determines routing
Data Link Layer (L2): Frames the data, adds MAC addresses
Physical Layer (L1): Converts the data into bits and transmits as signals (electrical, light, or radio)
How does a POST request flow UP through the OSI model when being received? Describe the process at each layer.
Starting from bottom to top:
Physical Layer (L1): Receives and converts signals back into binary data
Data Link Layer (L2): Checks frame integrity, removes frame headers, verifies MAC addresses
Network Layer (L3): Checks IP addresses, removes IP headers, reassembles packets if needed
Transport Layer (L4): Reassembles segments, removes TCP headers, checks for complete data
Session Layer (L5): Validates session, maintains connection
Presentation Layer (L6): Decrypts if necessary, converts from transmission format (e.g., JSON to object)
Application Layer (L7): Processes the HTTP POST request and passes to application
What specific data elements are added to the message at each layer when sending?
The data elements added at each layer are:
Application (L7): HTTP headers, method (POST), URL, body
Presentation (L6): Encryption, compression, data format indicators
Session (L5): Session identifiers, tokens
Transport (L4): TCP/UDP headers, port numbers, sequence numbers
Network (L3): IP headers, source/destination IP addresses
Data Link (L2): MAC addresses, frame headers and trailers
Physical (L1): Synchronization bits, signal patterns
What key checks are performed at each layer when receiving data?
Key checks at each layer:
Physical (L1): Signal integrity, bit synchronization
Data Link (L2): Frame check sequence (FCS), MAC address verification
Network (L3): IP address verification, packet integrity
Transport (L4): Sequence number checks, port number validation
Session (L5): Session validity, authentication status
Presentation (L6): Format compatibility, decryption success
Application (L7): HTTP request validity, content validation
What are the 7 main types of network intermediaries that a message might pass through between client and server?
Main intermediaries include:
Switches (Layer 2 device)
Routers (Layer 3 device)
Proxies
Load Balancers
CDNs (Content Delivery Networks)
Firewalls
Gateways
At which OSI layers do network intermediaries typically operate, and why don’t they need to look at higher layers?
Network intermediaries typically operate at:
Physical Layer (L1) - for signal transmission
Data Link Layer (L2) - for MAC addressing and switching
Network Layer (L3) - for IP routing
They don’t need higher layers because routing decisions are made based on addressing and routing information contained in these lower layers.
How does a switch handle a message and what OSI layer does it operate at?
A switch operates at Layer 2 (Data Link Layer) and:
Examines the MAC addresses in the frame header
Uses its MAC address table to determine the correct port
Forwards the frame only to the specific port needed
Doesn’t modify the data in higher layers
Creates separate collision domains for each port