test me

Site Search:

Ports, Sockets, Port Numbers and Multiplexing

source and destination port in TCP and UDP segment
source and destination port in TCP and UDP segment

Both TCP and UDP protocol support multiplexing. A PC might be running many network applications. When a packet arrives, the computer must decide to which application the packet should go, this process is called multiplexing. Multiplexing relies on the concept of socket. A socket is the ID of a running application, which consists of three parts: IP address, transport protocol and port number. For example, the socket of a web server might be (, TCP, 80).

Since a socket on a single computer should be unique, a connection between two sockets should identify a unique connection between two computers. The fact that each connection between two sockets is unique means that you multiple applications running at your computer can talk to applications running on your own computer or your friend's computer  at the same time. Multiplexing, based on sockets, ensures the data is delivered to the intended application.

Port number is similar to phone extension. In both TCP and UDP, port numbers start at 0 and go up to 65535. The port numbers are divided into three ranges: the Well Known Ports, the Registered Ports, and the Dynamic or Private Ports.

The Well Known Ports are those from 0 through 1023, includes the commonly used port numbers for well-known Internet services. For example:

  • port 21 for FTP

  • port 22 fro SSH

  • port 23 for Telnet

  • port 25 for SMTP

  • port 53 for DNS

  • port 67 and 68 for DHCP

  • port 69 TFTP

  • port 80 for HTTP

  • port 443 for SSL

Well-known Port Numbers

The Registered Ports are those from 1024 through 49151, assigned by the Internet Corporation for Assigned Names and Numbers (ICANN) to a certain use for proprietary applications.

The Dynamic and/or Private Ports are those from 49152 through 65535.

From programming perspective, the Sockets interface (ex. socket implementation in c library and java library) is used by TCP/IP application programmers to create sessions between software programs over the Internet. In general terms, a session is a persistent logical linking of two software application processes, to allow them to exchange data over a prolonged period of time.

If we are talking about TCP/IP Model, the socket is in Transport layer and Internet layer.  Take the socket (, TCP, 80) for example, In the transport layer TCP segment, we can find source port and destination port fields, and in the network layer packet, we can find source IP and destination IP.

ICND1 and ICND2 break down

No comments:

Post a Comment