Skip to content
Unit 2 Syllabus Note· Computer Networks

Computer Networks

Comprehensive exam revision notes for BCA-208N Unit 2 (Network Models, Layer Functionalities & Protocols). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.

Computer Networks

Network Models, Layer Functionalities & Protocols

Core Definitions & Key Concepts

Framing encapsulates packets from the network layer into discrete units (frames) with distinct start/end delimiters, source/destination MAC addresses, and error detection checksum trailers.

To prevent data from mimicking the special frame flag byte 01111110, the transmitter automatically injects a 0 bit after every five consecutive 1s. The receiver strips this stuffed zero.

Stop-and-Wait ARQ and Sliding Window ARQ

  • Stop-and-Wait: Sender transmits one single frame and stops, waiting for an ACK before sending the next.
  • Sliding Window: Sender can transmit multiple frames (up to window size W) consecutively before waiting for an ACK, filling channel bandwidth efficiently.

What is the maximum sender window size in Go-Back-N ARQ using m-bit sequence numbers

$W_s = 2^m - 1 If m=3 bits, maximum window size is 2^3 - 1 = 7$. Receiver window is always 1.

What is the maximum sender and receiver window size in Selective Repeat ARQ

$W_s = W_r = 2^{m - 1} If m=3 bits, maximum sender and receiver window size is 2^{3-1} = 4$.

How Cyclic Redundancy Check (CRC) detects errors

CRC treats binary messages as algebraic polynomials, appends r zero bits, and divides by a predetermined generator polynomial G(x) of degree r using modulo-2 binary division. The remainder is appended as the Frame Check Sequence (FCS).

The difference between TCP and UDP

  • TCP: Connection-oriented, reliable byte stream, ordered delivery, flow control, congestion control, 20-byte header.
  • UDP: Connectionless, unreliable datagram, best-effort delivery, no retransmissions, low latency, 8-byte header.

What are the three steps in the TCP Three-Way Handshake

  1. Client $\to$ Server: SYN (Synchronize sequence number X)
  2. Server $\to$ Client: SYN-ACK (Acknowledge X+1, own sequence number Y)
  3. Client $\to$ Server: ACK (Acknowledge Y+1)

Conceptual & Architectural Analysis

Compare Go-Back-N ARQ vs Selective Repeat ARQ in a Structured Table

DimensionGo-Back-N ARQSelective Repeat ARQ
Sender Window Size2^m - 12^{m-1}
Receiver Window Size1 (Fixed)2^{m-1} (Equal to sender window)
Out-of-Order FramesDiscarded immediatelyBuffered in receiver window
Retransmission ScopeRetransmits the lost frame AND all subsequent frames in windowRetransmits ONLY the specific lost/damaged frame
AcknowledgmentsCumulative ACK (ACK_N confirms all up to N-1)Individual ACK or Negative ACK (NAK)
Complexity & MemorySimple; minimal receiver bufferComplex; requires reordering buffers and timers per frame

The CRC Modulo-2 Division Process with a Complete Solved Example

CRC Modulo-2 Mathematical Derivation

Given: Data message M = 110101, Generator Polynomial G(x) = x^3 + x + 1 (Binary: 1011, degree r=3).

  1. Append r=3 zeros to data: M' = 110101000.
  2. Perform Modulo-2 Binary Division (XOR operations):
System Architecture / Concept DiagramHorizontal Scroll Enabled
        111001   (Quotient)
1011 | 110101000
       1011
       -----
        1100
        1011
        -----
         1111
         1011
         -----
          1000
          1011
          -----
           0110
           0000
           -----
            1100
            1011
            -----
             111  (Remainder = CRC FCS)
  1. Transmitted Codeword: 110101 + 111 = \mathbf{110101111}.
  2. At receiver, dividing 110101111 by 1011 yields remainder 000 (No Error detected!).

CSMA/CD vs CSMA/CA Protocols

FeatureCSMA/CD (802.3 Ethernet)CSMA/CA (802.11 Wi-Fi)
Full FormCollision DetectionCollision Avoidance
Collision ActionDetects collision while transmitting, aborts, and sends Jam signalTransmits RTS/CTS and backs off to prevent collisions
MediumWired copper shared cablesWireless unguided radio space
Why UsedElectrical signal collision is easily detectable on wireRadio transmitters drown out incoming weak collision signals

TCP Congestion Control Mechanisms (Slow Start, Congestion Avoidance, Fast Retransmit, Fast Recovery)

TCP Congestion Control Architecture

  1. Slow Start: Initial cwnd = 1 MSS. For every ACK received, cwnd increases by 1 MSS, effectively doubling cwnd every RTT (exponential growth).
  2. Congestion Avoidance: When cwnd ≥ ssthresh, growth becomes linear: cwnd = cwnd + 1 MSS per RTT (Additive Increase).
  3. Triple Duplicate ACKs: Signals single lost packet. Sets ssthresh = cwnd / 2. Executes Fast Retransmit (retransmits missing segment immediately without waiting for timer) and enters Fast Recovery.
  4. Timeout Event: Severe congestion. Drops ssthresh = cwnd / 2, resets cwnd = 1 MSS, and restarts Slow Start.

In-Depth Analysis & Implementation

The Complete TCP Header Structure and TCP Connection Life Cycle with State Transitions

1. TCP Header Structure (20–60 Bytes)

System Architecture / Concept DiagramHorizontal Scroll Enabled
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Source Port          |       Destination Port        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sequence Number                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Acknowledgment Number                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Data |           |U|A|P|R|S|F|                               |
| Offset| Reserved  |R|C|S|S|Y|I|            Window Size        |
| (4b)  |   (6b)    |G|K|H|T|N|N|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Checksum            |        Urgent Pointer         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Options (0 to 40 Bytes)                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  • Control Flags: URG (Urgent), ACK (Acknowledgment valid), PSH (Push buffered data), RST (Reset connection), SYN (Synchronize sequence numbers), FIN (Graceful connection teardown).

2. Connection Establishment & Teardown Handshakes

  • Three-Way Handshake: Client SYN \to Server SYN-ACK \to Client ACK (Establishes connection).
  • Four-Way Termination Handshake:
  1. Client sends FIN (enters FIN_WAIT_1).
  2. Server replies ACK (enters CLOSE_WAIT; Client enters FIN_WAIT_2).
  3. Server finishes remaining data and sends FIN (enters LAST_ACK).
  4. Client replies ACK and enters TIME_WAIT (waits 2 × MSL to ensure ACK received).

Hamming Error-Correcting Code Construction and Single-Bit Error Correction with a Solved Problem

Hamming Code Single-Bit Error Correction (7, 4 Code)

Given: 4-bit data word D = 1011 (d_7 d_6 d_5 d_3). We insert 3 parity check bits (p_1, p_2, p_4) at bit positions that are powers of 2.

1. Bit Arrangement Table:

Position7654321
Bit Named_7d_6d_5p_4d_3p_2p_1
Data Bits101?1??

2. Calculating Even Parity Check Bits:

  • p_1 covers positions with bit 0 set in binary (1, 3, 5, 7): p_1 \oplus d_3 \oplus d_5 \oplus d_7 = 0 \implies p_1 \oplus 1 \oplus 1 \oplus 1 = 0 \implies \mathbf{p_1 = 1}.
  • p_2 covers positions with bit 1 set in binary (2, 3, 6, 7): p_2 \oplus d_3 \oplus d_6 \oplus d_7 = 0 \implies p_2 \oplus 1 \oplus 0 \oplus 1 = 0 \implies \mathbf{p_2 = 0}.
  • p_4 covers positions with bit 2 set in binary (4, 5, 6, 7): p_4 \oplus d_5 \oplus d_6 \oplus d_7 = 0 \implies p_4 \oplus 1 \oplus 0 \oplus 1 = 0 \implies \mathbf{p_4 = 0}.

Transmitted 7-bit Codeword: 1010101.

3. Error Detection & Correction:

Suppose transmission noise flips bit 5 (1 \to 0), receiving 1000101.

  • c_1 = b_1 \oplus b_3 \oplus b_5 \oplus b_7 = 1 \oplus 1 \oplus 0 \oplus 1 = \mathbf{1}
  • c_2 = b_2 \oplus b_3 \oplus b_6 \oplus b_7 = 0 \oplus 1 \oplus 0 \oplus 1 = \mathbf{0}
  • c_4 = b_4 \oplus b_5 \oplus b_6 \oplus b_7 = 0 \oplus 0 \oplus 0 \oplus 1 = \mathbf{1}

Syndrome Word: c_4 c_2 c_1 = 101_2 = \mathbf{5}. Conclusion: Bit position 5 is corrupted! Inverting bit 5 from 0 back to 1 perfectly restores the original data.

The Minimum Frame Size Calculation in CSMA/CD Ethernet Networks

Minimum Frame Size Derivation in CSMA/CD

To ensure that a transmitting station detects a collision before it finishes transmitting the frame, the Transmission Time ($T_{\text{tx}}$) must be at least twice the Propagation Delay ($T_{\text{prop}}$):

$T_{tx} ≥ 2 × T_{prop}$

$\frac{L_{min}}{Bandwidth (B)} ≥ 2 × ≤ft( \frac{Distance (D)}{Propagation Speed (v)} \right)$

$L_{min} ≥ 2 × RTT × B$

Practical Example (Standard 10 Mbps Ethernet):

  • Cable distance = 2,500 meters, signal speed = 2 × 10^8 m/s, bandwidth = 10 Mbps.
  • T_{prop} = 2500 / (2 × 10^8) = 12.5 \; µs.
  • Round Trip Time (2 × T_{prop}) = 25 \; µs.
  • Accounting for repeater delays, slot time = 51.2 \; µs.
  • L_{min} = 51.2 \; µs × 10 Mbps = 512 bits = \mathbf{64 Bytes}.
  • Conclusion: Standard Ethernet frames have a mandatory minimum payload/frame size of 64 bytes (padded with dummy bytes if data is smaller).

Important Exam Points & Quick Revision

Practice CRC binary modulo-2 division, Hamming code parity calculations, and the TCP 3-way handshake diagram.

Your reading progress
0%

100% left on this page — finishing it closes the gap for Network Models, Layer Functionalities & Protocols.

Weak topic hint

Network Models, Layer Functionalities & Protocols still counts as a weak topic until you finish this note and answer its questions.

Practise this unit
What Should You Do Next?

Test Your Understanding

Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.