COMPUTER NETWORK AND SECURITY
  • Port:
    • A port is a logical endpoint for communication, identified by a numerical value known as the port number. Port numbers are used to distinguish different services or applications running on the same device. There are two types of ports: well-known ports and dynamic or ephemeral ports.
      • Well-Known Ports (0-1023): Reserved for commonly used services. For example, HTTP typically uses port 80, and HTTPS uses port 443.
      • Registered Ports (1024-49151): Assigned by the Internet Assigned Numbers Authority (IANA) to various applications and services.
      • Dynamic or Ephemeral Ports (49152-65535): Typically used as temporary ports by client applications when connecting to servers.
    • When two devices communicate, each endpoint of the communication will use a combination of an IP address and a port number. For example, a web server might use the IP address 192.168.1.1 and port 80 for HTTP communication.

 

  • Socket:
    • A socket is a combination of an IP address and a port number that uniquely identifies a specific endpoint in a network. Sockets are used to establish communication channels between processes running on different devices. In essence, a socket represents a communication endpoint, and it enables processes on different devices to send and receive data.
    • A socket is typically represented by a 4-tuple: (source IP address, source port number, destination IP address, destination port number).
    • In programming, a socket is an application programming interface (API) that provides a set of functions to establish, manage, and close network connections. Sockets are used by applications to communicate over a network, and they can be implemented in various programming languages.