file is: jokepseudo.html
Server Main loop
Create a server socket listening at port X
Loop while loopvar is true
Block while waiting for a connection to X
Spawn a new worker thread and pass it the connection.
Exit
Worker thread
Process the data coming over the connection.
Optional: If the data is shutdown, then change loopvar to false.
Close the connection
Terminate the thread.
--------------------------------------------
Joke Server Main loop
Create a Mode thread and send it off,
asynchronously, to get MODE instructions.
Create a server socket listening at port X
Loop while loopvar is true
Block while waiting for a connection to X
Spawn a new worker thread and pass it the connection.
Exit
Mode Server Main Loop
Create a server socket listening at port M
Loop while Server still running.
Block while waiting for a connection to M
Spawn a new ModeWorker thread and pass it the connection.
ModeWorker thread
Process the data coming over the connection.
If the data is mode change, then change the MODE (e.g., from joke mode to
proverb mode)
Optional: If the data is shutdown then change the loopvar for main to false
Close the connection
Terminate the thread.
Worker thread
Process the data coming over the connection, according to the mode.
Close the connection
Terminate the thread.