Skip to main content

How Computers Talk to Each Other

I was asked by a friend to explain how computers talk to one another, as she had no understanding of computer networking...or how computers talk, send data, to each other.

To start, every computer on a computer network has to have a unique address. The address consists of a network portion, and an identifier for the specific device (computer, printer, tablet, smartphone, etc.). While a user isn't concerned with the difference between the "network" portion and the "device" portion, it helps to realize that they are both included in the address. Currently, the most common address format is in the format of xxx.xxx.xxx.xxx where x is a value between 0 and 255. If you look at the range, there are 256 values for each section (each group).

(A few people have asked "why does it stop at 255?" Computers deal only with bits, which have one of two values: 0 and 1. Combinations of 0s and 1s have additional meaning. Computers are binary systems (meaning they only understand two digits). The possible combination of values from 0 to 255 is represented by a group of 8 bits, or combination of 0s and 1s. In this case, the network address is actually 4 bytes or 32 bits.)

Each value is actually 1 byte in the address. Specifically, we refer to this as an IP, or Internet Protocol, Address. You may see it abbreviated as either IP Address, TCP/IP Address, or occasionally even IP Addy (short for address).

Since each computer has a unique address, we know "where" the computer is. We also require a few other pieces of information. We need to find a port on the destination system to talk to. This port is connected to an application that listens for data and/or commands. After the computer(s) start talking with each other, they may agree to move to another port for further communication.

This is some special software, called Domain Name Service or DNS, that relate IP Addresses to computer names, and vice-versa. This helps resolve, or change, computer names to IP Adresses. Since computers ONLY talk to each other by IP Address (See RFC 1518 - http://tools.ietf.org/rfc/rfc1518.txt and http://tools.ietf.org/rfc for more information), which solves two fo the five necessary requirements for computers to talk, especially since your computer already "knows" it's own IP Address.

We now understand the importance of IP Addresses, or at least as part of the communication process, computers need to have a protocol. The protocol helps both computers understand how the data is communicated between them. This explains the "language" of the data being communicated. Like someone converting Spanish to English, this explains that the first X number of bits are the source IP Address, the next Y group of bits are the destination address, and the next group of Z bits are the type of data being transmitted, the next group is any error checking and other "management", and the data being sent to the destination system. In short, the protocol is the understanding of what the data stream is supposed to look like. Of course, there is a lot more information that that in each data packet.

The last thing to understand is the port. The operating system creates special memory locations that programs can connect to. The program can connect to one or more of these memory locations and respond to data or commands that come into and out of this special memory. Usually after the initial communication takes place, the server portion will tell the client, "Hey, next time you talk to me, talk on a different port - we'll call it 'Y'." This allow a service (an application) to always listen on a single port for incoming communications (like the Web Server called Apache which listens on Port 80 or Port 443 and moves the communication to a different port).

Sometimes people wonder if they need to know all these ports (off the top of their head). In reality, the answer is no. Most applications send an expected port along with their data. For instance, when you send an email your email software knows to sned it using SMTP (Simple Mail Transport Portocol) on port 25 (as one example, your email client may also use other ports depending on how it is communicating with the eMail Service). In another example, you request a web page using your web browser over the HTTP (Hyper Text Transport Protocol) on port 80 or port 443 if it is an encrypted / secure connection.

There are many common protocols with known ports, and a list of them is probably on your computer system. Under Linux or on a Macintosh, these are usually listed in a file called /etc/services. For Microsoft Windows computers, the file may exist in C:WindowsSystem32Driversetcservices on Windows 2000 and Windows XP. For these Operating Systems, they are normal text files that can be viewed, but should not be edited or changed (even if the computer allows you to). If you were to make a change and successfully save the file, you won't have any impact to the system as these are more for reference than for actual operation. But you could confuse other people with any inadvertent changes if they happen to look at the file.

Changes

  • Should I include a reference section?
  • Should I include a list to RFC?
  • Do I have a networking 101 Document