Writing a small battleship game server in Python

Dan dan at cellectivity.com
Thu Aug 11 12:34:56 EDT 2005


> The server should accept connections from new players and be able to handle 
> multiple games concurrently.

Multiple threads would be the way to go for a real application. But if
you want to avoid the complexity involved in threading and
synchronization in this exercize, you can avoid threads by using
"select" instead:
  http://www.python.org/doc/2.3.5/lib/module-select.html

The "select" function allows you to determine (without blocking) which
sockets have input available.

Python's "select" is a wrapper for the C function with the same name. On
Unix you can learn more about it using "man select".

-- 
  Yield in childhood to selfishness and you will find it the
  most enchaining tyrrany on earth.
    - Oswald Chambers, My Utmost For His Highest, p. 74





More information about the Python-list mailing list