
PORT VS SOCKET
1️⃣ What Is a Port? A port is just a number (0–65535) that identifies a service on a machine. Think of it like: IP address → identifies the machine Port → identifies the application inside the machine Examples: 22 → SSH 80 → HTTP 443 → HTTPS 3306 → MySQL When you see: 192.168.1.10:443 That means: Machine IP = 192.168.1.10 Service = running on port 443 👉 A port by itself does NOT mean a connection exists. It just means a process is listening. 2️⃣ What Is a Socket? A socket is a full communication endpoint. It includes: IP address + Port + Protocol (TCP/UDP) But a real TCP connection is uniquely identified by: Source IP + Source Port + Destination IP + Destination Port + Protocol Example: Client: 10.0.0.5:51512 Server: 192.168.1.10:443 Protocol: TCP That 5-tuple defines one unique connection. So: Port Socket Just a number Full communication endpoint Identifies a service Identifies a connection Exists without traffic Exists during communication 3️⃣ How Is a Socket Created? Sockets are cre
Continue reading on Dev.to
Opens in a new tab



