What is a Server?
A server is a computer program that sends data to clients connected to it, and clients are computer programs that receive data from a server. These terms typically refer to programs running in different computers connected through the Internet. For example, a web server that serves webpages to web clients such as web browsers that connect to it. Because of this, the term "server" may also refer to the physical computers running the server programs. A server and a client may also be in the same computer, as is the case of a language server, for example.
Servers are necessary to play online games, whether they're between few people, like Minecraft or Terraria, or between a lot of people, like World of Warcraft. In this case, the server is where the state of the game is actually saved. Say, for example, that two people are connected to a server. The first person has a latency of 100ms (their ping* is 100ms). The second person has a latency of 200ms. This means that when the first person does something, a command comes from their computer where the game client is, and goes over the internet to the game server, taking 100ms to reach there. The server updates the state of the game with the action the player took. Then the data goes to the second person, taking 200ms to reach there. This means that it takes, at minimum, 300ms in this case for one person to see what the other person just did.
*note: ping sometimes means round time trip (RTT), which is the time to go to the server and back, which naturally would take longer. This is important in TCP connections, but I games normally use UDP instead, if I remember correctly, exactly to avoid such round trip as it's faster that way.
In general, the term server is used when there is a centralized server that multiple clients connect to. However, there is no reason why the clients couldn't connect to reach other directly. Except in this case they would be both client and server, as they both receive and send the data. A system where clients transfer data to each other is sometimes called p2p (peer to peer). An example of this is BitTorrent, a p2p file-sharing protocol.
Leave a Reply