This module provides a simple server real IGS clients can connect to using
localhost:8888. Additionally for a test and debugging run the client of this
demonstration should connect to this server to allow some basic control.
To bind the server to another port than the default 8888 use the commandline
parameter -b <port>.
Imported modules
|
|
import IGSCP.__init__
import demo
from igs_messages import *
import socket
import string
import sys
import threading
|
Functions
|
|
broadcast
cleanup_threads
client_conn
main
run_server
send
shutdown
|
|
broadcast
|
broadcast ( text, req=None )
Send text to all connected clients except the requesting one if the req argument is given.
If req is None, send to all clients without exception
|
|
cleanup_threads
|
cleanup_threads ()
Remove dead threads from threads list
|
|
client_conn
|
client_conn ( conn, addr )
This function is called within an own thread to handle communication with one client
|
|
main
|
main ( args=None )
Server main method. Parse commandline parameters and then start the server.
|
|
run_server
|
run_server ( port=None )
Run server and wait for connections
|
|
send
|
send ( conn, text )
|
|
shutdown
|
shutdown ()
Shutdown server and inform clients
This sometimes still hangs because one thread is locked in the recieve command,
but a forceful Ctrl-C in the server terminal usually does the trick.
|