Introduction to TCP/IP and routing : Introduction to IP : Transport protocols : Ports, sockets
Previous: Transport protocols
Next: IP on different medias ("links")

1.3.1. Ports, sockets

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.

1.3.1.1. Sockets

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).


Introduction to TCP/IP and routing : Introduction to IP : Transport protocols : Ports, sockets
Previous: Transport protocols
Next: IP on different medias ("links")