But to my understanding a port number cannot be in use more than once. If I had two processes using the same protocol they would use the same designated port right?
Most protocols have a designated default port.
For instance, if you intend to do HTTP, you will use TCP port 80 by default. If you intend to do HTTPS, you will use port 443 by default. And so on.
But most protocols can use alternate ports.
For instance, you can include the port in HTTP or HTTPS URIs (http://www.example.org:1234/this or https://www.example.org:5678/that). This would tell the underlying protocol to use ports 1234 or 5678 instead of the defaults, respectively.
So you could have multiple HTTP servers listening on different ports. This is quite common in some environments (e.g. node processes behind a reverse proxy).
Likewise, a listening port can only have one attached process for a given IP address and IP protocol (an IP protocol is UDP or TCP, through there are others):
- You could have one application using UDP port 1234 and another using TCP port 1234.
- You could have one application listening on port 80 for IP 192.168.0.100 and another one listening on the same port 80 for IP 192.168.0.200.
What the book is probably trying to say, though, is that if you design your own protocol (the Poly-Incremental Neural-Knowledge protocol, known as PINK), you probably shouldn't use a port that is used by other existing protocols. For instance, don't use TCP ports 80, 443, 21, 22, 25, etc, because if you do, when some user wants to install your server on their box, and they already run an HTTP, HTTPS, FTP, SSH or STMP server on the same box, they will have a conflict: the server started last will refuse to run (unless the user switches the default port of one of the two, or uses different IP addresses for each).