Home‎ > ‎

Simple Servers

The final level for gaming is using multiple computers talking to each other. Every player has their own computer and the computers communicate and coordinate the players together.

We use ports and sockets for computers to communicate with each other. Every computer has a unique address called it's IP Address. Since so many devices are connected and talking to the computer (mouse, keyboard, Internet, etc) each one is given it's own Port to use. The port is like a doorway to that computer.

There are over 64,000 ports on a computer. Many of the are already in use. For instance, browsers use port 80. Generally, ports 1 to 5,000 are already allocated. We can use anything above that. For our example, we will use port 9000 and our computer's Internet address is 10.53.24.101. 

The complete address looks like this: 10.53.24.101:9000. 

The main computer (called the Server) has to open the port (doorway) for the other computers to use. They then "Connect" to that port. From then on they "talk" with reads and write on that port.

The sockets are the software/clients that we talk to. The sockets do the work. Communication occurs between sockets but go through ports.

You can down load the attached files which allow 2 computers to talk. Run each one on a different computer, start them up and see how it works. You can look at the code to see how simple it is to do.
Ċ
cyril.pruszko@pgcps.org,
May 1, 2013, 8:55 PM
ċ
SimpleSocketClient.livecode
(3k)
cyril.pruszko@pgcps.org,
May 1, 2013, 8:44 PM
ċ
SimpleSocketServer.livecode
(3k)
cyril.pruszko@pgcps.org,
May 2, 2013, 7:07 AM
Comments