For the UDP and TCP procotols, Instead of having a source address and a destination address (which already are mentioned in the IP packet header), we have a source port and a destination port.
The notation for the port is [IP ADDRESS]:[PORT]
, e.g.:
172.16.1.2:80
Each IP host is capable of offering services on both UDP and TCP, in a range of 2^16 ports, which means that:
2 * (2^16) = 131072
There are therefore 131072 possible services on one host, but many more connections are possible, since each port can service multiple connections.
When established, the combination of IP address + port is called a socket.
Once the socket has been created, two-way communication can then begin,
using standard system calls like read(2)
and write(2)
.