TCP, UDP , Three-way
handshake and Common ports
and protocols and OSI Model
Created time @November 3, 2025 3:43 PM
TCP, UDP , Three-way handshake
TCP(Transmission Control Protocol)
connection-oriented protocol for communications that helps in the
exchange of messages between different devices
TCP flags
TCP flags are doing connection establish, maintain and terminate for data
transfer
1. SYN(Synchronization)
initiates a connection between hosts
2. ACK(Acknowledgement)
it is the receipt of a packet
3. URG(Urgent)
data contained in the packet should be processed immediately
4. PSH(Push)
sends all buffered data immediately
5. RST(Reset)
resets a connection
6. FIN(Finish)
there will be no further transmission
3-Way Handshake
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 1
The TCP 3-way handshake is a fundamental process that establishes a
reliable connection between two devices over a TCP network
TCP header
Source Port Address
A 16 bit field that holds the port address of the device that is sending the
data segment.
Destination Port Address
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 2
A 16 bit field that holds the port address in the device that is receiving the
data segment.
Sequence Number
A 32 bit field that holds the sequence number
Every packet has a sequence number.
Acknowledgement Number
A 32 bit field that holds the acknowledgement number It is an
acknowledgement for the previous data being received successfully.
Header Length (HLEN)
This is a 4 bit field that indicates the length of the TCP header by a number
of 4-byte words in the header
Control flags
These are 6 bit control bits that control connection establishment,
connection termination, connection abortion, flow control, mode of transfer
etc. Their function is:
URG
ACK
PSH
RST
SYN
FIN
Window size
This field tells the window size of the sending TCP in bytes.
Checksum
This is 16 bit field that the checksum for error control. It is mandatory in
TCP as opposed to UDP.
Urgent pointer
This field (valid only if the URG control flag is set) is used to point to data
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 3
UDP
User Datagram Protocol
UDP is a communications protocol for time-sensitive applications like
gaming, playing videos
TCP VS UDP
TCP UDP
creates a connection between
sends data without a connection
two devices
breaks data into packets with
doesn’t assign sequence number
sequence number
sends packets and waits for sends packets without waiting for
acknowledgments acknowledgments
resents lost packets to make sure
doesn’t resent lost packets
all data is received
Common ports and protocols
Port is a logical address of a 16-bit unsigned integer that is allotted to every
application on the computer that uses the internet to send or receive data
Type of ports
Well known port
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 4
range : 0-1023
It is reserved for common and specifically used service
HTTP(port 80), FTP(port 21), DNS(Port 53), SSH(port 22)
Registered Port
range : 1024-49151
used by specific applications or services
Microsoft SQL Server(1433)
Dynamic Port
range : 49152 - 65535
used for those connections that are temporary or short-lived
web browsing , downloads
Some common ports and protocols
FTP (21)
File transfer protocol
Transfers files between client ↔ serve
it use tcp
SSH (22)
Secure shell
Secure login to remote machines
encrypted
Telnet (23)
remote login (unsecure)
SMTP (25)
Simple Mail Transfer Protocol
Used to send email
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 5
DNS (53)
Domain Name System
convert domain names to IP addresses
HTTP (80)
access normal websites (not secure)
HTTPS (443)
access secure websites (encrypted)
POP3 (110)
Post Office Protocol v3
Download emails from server → client
SMB (139, 445)
Server Message Block
Windows file sharing (shared folders, printers)
IMAP (143)
Internet Message Access Protocol
Read/manage emails directly from the server (better than POP3) with gmail
app. Keeps emails on the server and synchronizes them across all
connected devices
DHCP (67, 68)
Dynamic Host Configuration Protocol
Automatically gives IP
67 - used by DHCP server
68 - used by DHCP claint
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 6
SNMP(161)
Simple Network Management Protocol
Used to monitor and manage network devices (routers, switches, servers)
TFTP (69)
Trivial FTP
Very simple file transfer
it use UDP
OSI Model
The OSI (Open Systems Interconnection) Model is a set of rules that
explains how different computer systems communicate over a network. OSI
Model was developed by the International Organization for Standardization
(ISO).OSI Model consists of 7 layers
They are
[Link] Layer
the actual physical connection between the devices. The physical layer
contains information in the form of bits
Devices : Hub, Repeater, Modem and Cable
[Link] Link Layer (DLL)
The data link layer is responsible for the node-to-node delivery of the
message. The main function of this layer is to make sure data transfer is
error-free from one node to another, over the physical layer. Packet in the
Data Link layer is referred to as Frame. It is use the mac address to transmit
data.
Devices: switches and bridges
3. Network Layer
The network layer works for the transmission of data from one host to the
other located in different networks. It also takes care of packet routing i.e.
selection of the shortest path to transmit the packet, from the number of
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 7
routes available. The sender and receiver's IP address are placed in the
header by the network layer.
Devices: Router, Brouter
[Link] Layer
The data in the transport layer is referred to as Segments. It is responsible
for the end-to-end delivery of the complete message. Transport layer use
TCP,UDP protocol.
5. Session Layer
Session Layer in the OSI Model is responsible for the establishment of
connections, management of connections, terminations of sessions
between two devices. It also provides authentication and security.
6. Presentation Layer
The presentation layer is also called the Translation layer.
Data Encryption/ Decryption, Data Compression, Character code
translation, Formated and Encrypted
7. Application Layer
The application layer is the human-to-computer interaction layer. It ensures
that the data is in readable format for the receiver and the sender both.
TCP/IP model
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 8
1. Application Layer
It is user interface layer and this is where all the apps you use like web
browsers, email clients, or file sharing tools connect to the network. Its
protocols include HTTP, FTP, Post Office Protocol 3 (POP3), SMTP, DNS,
Dynamic Host Configuration Protocol and SNMP.
2. Transport Layer(TCP/UDP)
The Transport Layer is responsible for making sure that data is sent reliably
and in the correct order between devices. It checks that the data you send
like a message, file, or video arrives safely and completely.
3. Internet Layer
The Internet Layer is used for finding the best path for data to travel across
different networks so it can reach the right destination. It works like a traffic
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 9
controller, helping data packets move from one network to another until
they reach the correct device
4. Network Access Layer
It deals with the actual physical connection between devices on the same
local network like computers connected by cables or communicating
through Wi-Fi.
TCP, UDP , Three-way handshake and Common ports and protocols and OSI Model 10