Difference between Socket and Port?
Both Socket and Port are the terms used in Transport Layer. A port is a logical construct assigned to network processes so that they can be identified within the system. A socket is a combination of port and IP address. Port number can be represented by a single number ( example: 1028) on the other hand socket address can be represented by (tcp, hostname ,1028). An incoming packet has a port number which is used to identify the process that needs to consume the packet. The lowest numbered 1024 port numbers are used for the most commonly used services. These ports are called the well-known ports. Higher-numbered ports are available for general use by applications and are known as ephemeral ports.
|The word “Socket” is the combination of port and IP address.
||The word “Port” is the number used by particular software.
|It is used to identify both a machine and a service within the machine.
||The same port number can be used in different computer running on same software.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!