“Client” and “server” actually describe a pattern that’s much older and more widely used than the World Wide Web. These terms describe a really common way for computers to communicate, where one computer – the client – asks the questions, and the other – the server – provides the answers. It’s how the web works: a browser – aka a “web client” – loads a web page by requesting it from a “web server.” But there are other kinds of clients and servers as well. For example, if you’ve ever installed a Ruby gem you’ve used a client (RubyGems) to make a request to a gem server (possibly the one at rubygems.org) to get it.
Protocols
When a client sends a message to a server, it’s just a string of bytes. Just as humans need a common language in order to communicate, clients and servers need a common understanding of how to interpret the bytes they are sending back and forth. The shared rules that allow them to interpret messages is called a protocol.
The Internet
So, the internet is just a big network of clients and servers sending requests and responses back and forth. All this communication relies on two key protocols to make it work: IP and TCP.
IP
The first of these is a protocol for addresses, aka finding the right destination for a message. It’s called IP, or Internet Protocol. You’ve probably heard of IP addresses.
A port is used to differentiate among different applications using the same network interface. It is an additional qualifier used by the system software to get data to the correct application. Physically, a port is a 16-bit integer. Some ports are reserved for particular applications; they are labeled as well-known ports.