stock market

What is Protocols.

Spread the love

A protocol is a set of rules that defines how two or more systems communicate with each other.

1.What is Transmission Control Protocol(TCP)
  • Connection oriented protocol
  • Reliable, ordered, and error-checked communication
  • Ensure data reaches the destination correctly

When accuracy and consistency are critical, TCP usually right choice.

2.What is UDP User Datagram Protocol.
  • Connectionless protocols.
  • Faster, but no delivery guarantees.
  • No retransmission of lost packets.

Use Cases: When to use TCP & UDP

  • When to use TCP: if data integrity is critical, TCP is the way to go.
    • Web browsing (HTTP, HTTPS)
    • File transfer (FTP, SFTP)
    • Email (SMTP)
    • Database communication.
  • When to use UDP: UDP is preferred when speed is more important than reliability
    • Video streaming (YouTube, Netflix)
    • Online gaming (Multiplayer gaming)
    • VoIP Call (Skype, Zoom)
    • DNS Lookup (Domain Name system)
3. HTTP

1. Introduction to HTTP:

  • What is HTTP.
    • Stands for Hypertext transfer protocol
    • Foundation for web communication
    • Defines rule for requesting and transferring resources
    • Works over TCP/IP (port 80 for HTTP , port 443 for HTTPS)
  • Key Features
    • Text based protocol
    • Stateless
    • Supports Multiple Methods

2.How HTTP Works

  • Client-server Models
    • Clients make an Http Request
    • Server process the request and sends back a response.
  • Components of and HTTP Request
    • Method: defines an action
    • URL: resource being requested
    • Header: Metadata
    • Body: data sent in POST/PUT api.
  • Component of an HTTP Response
    • Status code indicate that success or failure
    • Headers: Metadata about the response
    • Body: The actual content return
  • Http Request-Response Cycle
    • Step-1: Browser send a request
    • Step-2: web server processes the request
    • Step-3: server generates a response and send it back
    • Step-5: browser render the response
  • Stateless Nature of Http
    • What does stateless means
      • Http does not retain memory of previous request.
    • Challenges of Statelessness
      • Hard to maintain user sessions
      • Each request must carry all necessary information 
    • How do we handle state
      • Cookies: Small piece of data stored in the browser
      • Session: Server-side storage of user state
      • Tokens (JWT, OAUTH): Used for Authentication and Authorization
  • Http Method:
    • Common Http Method and there uses
      • GET: Retrieve a resources 
      • POST: Send data to create a new resource
      • PUT: update an existing resource
      • DELETE: Remove a resources (IDEMPOTENT)
      • PATCH: partially update a resources
  • What about Https
    • Https is the secure version of HTTP, using SSL/TLS encryption
    • It ensures data confidentiality, integrity, and Authentication
    • Used for secure website, online banking and eCommerce.
    • Works on Port 443 instead of port 80.

Common Protocols

ProtocolMain Purpose
HTTPCommunication between web clients and servers
HTTPSSecure HTTP communication
TCPReliable data transmission
UDPFast data transmission with less overhead
FTPFile transfer
SMTPSending emails
DNSConverts domain names into IP addresses
WebSocketReal-time, two-way communication
SSHSecure remote computer access
MQTTLightweight messaging, commonly used in IoT

Leave a Reply

Your email address will not be published. Required fields are marked *