TheHingineer

  • Computer Networks


  • CN Part-1

  • CN Part-2

  • CN Part-3

  • CN Part-4

  • CN Part-5

  •  File and Web Protocols: FTP, HTTP, and HTTPS in Computer Networks

     Overview: Data Sharing on the Internet

    • Internet par information exchange ke do sabse common use cases hain: Files transfer karna (FTP) aur Web pages access karna (HTTP/HTTPS).

    • Yeh sabhi Application Layer protocols reliable transport ke liye TCP par rely karte hain.

     1. FTP (File Transfer Protocol)

    • FTP ek standard client-server protocol hai jo ek host se doosre host par computer files upload aur download karne ke liye use hota hai (RFC 959).

    • Two-Connection Architecture (Exam High-Yield!):
      FTP ki sabse unique baat yeh hai ki yeh do alag-alag parallel TCP connections use karta hai:

    Client                                                       FTP Server
      |                                                              |
      |====== 1. Control Connection (Port 21 - Commands/Login) =====>| (Out-of-band: Stays OPEN throughout session)
      |                                                              |
      |<===== 2. Data Connection (Port 20 - Actual File Transfer) ==>| (In-band: Opens per file & CLOSES when file finishes)
      |                                                              |

    A. Control Connection (Port 21): Commands (USER, PASS, LIST, RETR) aur server responses ke liye. Poore session ke dauran hamesha open rehta hai.
    B. Data Connection (Port 20): Actual file bytes ko transfer karne ke liye. Har file transfer shuru hone par open hota hai aur file khatam hote hi close ho jaata hai.
    (Control information ko data stream se alag rakhne ki is property ko Out-of-Band Control kaha jaata hai).

     2. HTTP (HyperText Transfer Protocol)

    • HTTP World Wide Web (WWW) ka foundation protocol hai, jiska use web servers se HTML web pages, images, stylesheets aur APIs fetch karne ke liye hota hai (RFC 2616).

    • Port 80 par TCP connection establish karta hai.

    • Core Properties:

      • Request-Response Model: Client HTTP Request bhejta hai, server HTTP Response return karta hai.
      • Stateless Protocol: Server har request ko completely independent maanta hai aur purani requests ka koi record nahi rakhta. Sessions maintain karne ke liye Cookies aur Tokens use hote hain.
    • Common HTTP Methods: GET (data read karna), POST (data submit karna/form fill), PUT (update karna), DELETE (remove karna).

    • HTTP Status Codes: 200 OK, 301 Moved Permanently, 404 Not Found, 500 Internal Server Error.

     3. HTTPS (HyperText Transfer Protocol Secure)

    • HTTP ka sabse bada drawback yeh tha ki saara data (passwords, credit card numbers, chats) Plaintext mein network par travel karta tha. Koi bhi hacker Wi-Fi par packet sniffing karke aapka password chura sakta tha (Man-in-the-Middle Attack).

    • Is security problem ko solve karne ke liye HTTPS banaya gaya:

    HTTPS = HTTP + SSL / TLS Encryption Default Port: 443
    • HTTPS communication start hone par TLS Handshake karta hai jisme:

      1. Server Authentication: Server apna digital certificate show karta hai taaki client verify kar sake ki wo genuine website se baat kar raha hai.
      2. Encryption: Asymmetric cryptography ke through ek symmetric session key exchange hoti hai. Iske baad saara data strong AES encryption ke saath travel karta hai.
      3. Data Integrity: Hashing (SHA-256) use hoti hai jisse koi beech mein web page content ko modify na kar sake.

     HTTP vs HTTPS Comparison Table

    Feature HTTP HTTPS
    Security & Encryption Unencrypted Plaintext (Insecure). Encrypted using SSL/TLS (Highly Secure).
    Default Port TCP Port 80 TCP Port 443
    Digital Certificate Not required. SSL/TLS Certificate issued by a CA required.
    Browser Icon “Not Secure” warning indicator. Secure Padlock icon.
    Performance Fast (zero encryption overhead). Minor cryptographic handshake latency (modern HTTP/2 & HTTP/3 optimize this).

     Summary Table

    Protocol Ports Summary
    FTP 21 (Control), 20 (Data) Dual TCP connections: Out-of-band commands on 21, raw file data on 20.
    HTTP Port 80 Stateless request-response web protocol over plaintext TCP.
    HTTPS Port 443 Encrypted HTTP over TLS providing Confidentiality, Integrity, and Authentication.
    Scroll to Top