Computer Network

A communication system in which many devices(hosts/nodes) is talking to each other. Devices like mobile, smart fridge, CCTV camera, car, industrial machines.

Why ?

  • Better connectivity - All devices will be linked
  • Resource sharing - cloud storage, computing power
  • Better communication - video calls, emails, social media
  • People Bring Together - Social media, communication aj ka pura internet “network of networks” hai. Chhote-chhote LANs milke bada WAN banate hain.

Types of Computer Networks

FeatureLAN (Local Area Network)WAN (Wide Area Network)
Area CoveredSmall – one room, building, or campusLarge – cities, countries, or continents
SpeedVery fast (1 Gbps, up to 10/40/100 Gbps)Slower than LAN
CostLow long-term costHigher recurring ISP cost
TechnologyEthernetLeased lines, Fiber, Internet
OwnershipPrivate organizationISP / Telecom provider
ExampleHome, Office, College LabInternet

Key Difference: You have the ownership of LAN can control it fully, but not of WAN

Data Communication over a Network

Imagine nodes A (sender) to H (receiver) tak, beech mein routers B,C,D,E,F,G.

  1. Circuit Switching - dedicated path of communication is established in starting only between A and H.

How it Works?

  1. Connection Establishment (Phase 1): Path fix aur reserve (dedicated logical channels). Initial delay hota hai.
  2. Data Transfer (Phase 2): Max possible speed, guaranteed bandwidth, no interruption.
  3. Connection Termination (Phase 3): Resources release - dusre users use kar sakein.

Advantages:

  1. Perfect for Continuous flow like voice.
  2. Predictable, reliable performance.

Disadvantages:

  1. Computer data bursty hota hai - kabhi bohot data, kabhi zero. Channel reserved rehta hai → low utilization, waste of resources.
  2. Initial delay always
  3. Not good for modern internet (data traffic)
  1. Packet Switching (My Fav) - Message is broken into short packets (~kbytes)

Steps:

  1. Longer message broken up into smaller chunks
  2. Har packet mein header add (destination address, sequence, etc.).
  3. Packets alag-alag bhej do. As they are independent and knows where to go

Store-and-Forward (Sabse Important Concept)::

  1. Router (Intermediate route) packet receive karta hai → apne buffer (temporary memory) mein store karta hai.
  2. Routing table dekhta hai → decide karta hai next link konsa.
  3. Phir forward karta hai.
  4. Agar next link busy → buffer mein wait.
  5. Fayda: Link utilization badhta hai, data rate conversion possible (fast incoming → slow outgoing), priority de sakte ho.

Advantages:

  1. Links can be shared; utlisation = better
  2. Suitable for computer generated busted traffic
  3. Flexible - congestion ho toh alternate route.
  4. Buffering + priority easy.

Disadvantage of Packet Switching

  1. Unordered Delays: Packets may arrive out of sequence, while circuit switching ensures ordered delivery since all data follows the same path.
  2. Need of Sequence Number: To reassemble data correctly, each packet must carry a sequence number.
  3. Increased Complexity: Each node must be capable of routing packets dynamically, which adds to the complexity.
  4. Rerouting and queuing can introduce delays, especially under high network load.
  5. While ideal for small or burst data, packet switching can be less efficient for large, constant data transmissions compared to circuit switching.

Garvit Hacking Angle: Yeh samajh ke tu packet sniffing, fragmentation attacks, routing manipulation kar sakta hai.

Packing Switching Approches

a. Virtual Circuit = Packet Switching + Circuit Switching jaisa behaviour

  1. Circuit switching jaisa lekin packets ke liye.
  2. Pehle route establish karo (connection phase).
  3. Sab packets same fixed path follow karenge.
  4. Har circuit ko [[Virtual Circuit Number (VC#)]] milta hai.
  5. Header mein sirf VC# hota hai → routers uske hisaab se forward (no need full address every time).
  6. Har router apne routing table mein VC# → next link store karke rakhta ha
  7. Store-and-forward toh hota hi hai.
  8. No dynamic routing per packet - path fixed rehta hai.

Drawback:

  1. Link slow ho jaaye tab bhi same path use karte raho - not adaptive.

Example:

Tu A se H tak data bhej raha hai. Virtual Circuit bana diya → path A→B→E→H. Ab saare packets isi path pe jayenge, bhale hi beech mein traffic ho. Agar koi link slow ho gaya toh bhi wohi path use hoga

Pure Circuit SwitchingVirtual Circuit (Packet Switching)
PathDedicated physical/logical pathFixed logical path (shared links)
BandwidthGuaranteed dedicatedNo strict guarantee, shared
PacketsContinuous stream (no packets)Small packets, same route
Connection PhaseYesYes (route establish)
Dynamic RoutingNoNo (fixed path once set)
Link UtilizationPoor (bursty data waste)Better than circuit, but not best