Server - a central computer that multiple people/apps/other computers/devices can connect to to exchange data. It’s usually always on and reachable by anyone allowed to.
Client - any computer / device / app / person attempting to connect to said server. In the mobile app world your device / app is usually the client.Though in Peer-to-peer communications your device/app could become a server if you let other devices connect to you.
All Internet based communications between computers uses sockets. Think of them as a pipe. Your client opens a connection to a specific port on the server where the service you want to access is listening.
Once this connection (a socket) is established, data can begin flowing between the computers (your device is a computer for the remainder do this post) Some things like connecting to web services, like the REST services I talked about use sockets, but the service has been abstracted so that you don’t have to worry about the socket level programming (and relative to Lua and Corona, it’s pretty low level stuff).
In other words way under the hood network.request() opens a socket to port 80 of a web server, transmits some data, reads the resulting data the hangs up (closes the socket). Web services are designed to work for short lived, large one-time data dumps.
There is a lot of overhead to make that socket connection and the open and close model of the web doesn’t allow for high speed, low latency communications. It Is great to fetch your Facebook friends or update your twitter status, but your not going to do Call of Duty multiplayer that way.
For those types of games you have to have a server where you can have a program run all the time (also referred to as a server. Think of a software server running on the hardware server). The game server runs all the time and listens for incoming socket connections. But unlike web services, the client and server keep the socket open and exchange small bursts of data called packets.
The server looks at the packet and processes it, enforcing game rules or forwarding it to other players in the same game. The server can generate messages to any or all of the attached clients. Your client of course has to accept the inbound packets/messages and do with them what ever your game requires of it. When the game is over or your player quits, then the socket gets cleaned up and closed.
Sockets are not endless (limited amounts) so you have to mange it as a resource too. Hope that helps explain things in a general fashion.
Rob
(EDIT: Interesting, I entered this on my iPad and it lost all the paragraph breaks… Edited to break the text back up)
(EDIT2: Fix the autocorrects and typos)