|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
SundayServer.SundayClientThread
This inner class represents an individual client connection to the server. This thread persists while the client connection does.
| Field Summary | |
private Socket |
client
The socket that is connected to our client. |
private BufferedReader |
in
Connected to the sockets input stream. |
private PrintWriter |
out
Connected to the socket's output stream. |
private SundayServer |
server
A reference to our parent class. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
SundayServer.SundayClientThread(Socket inClient,
SundayServer inServer)
Construct the thread by simply saving the passed in variables. |
|
| Method Summary | |
private void |
dropDrink(String command,
String username)
Parses out the information, verifies everything, and then drops the drink. |
private void |
dropRand(String command,
String username)
Drops a random drink. |
void |
editSlot(String command)
Edit a slots information. |
private void |
editUser(String command)
Edit a users account information. |
private void |
getStats(String command)
Print the contents and statistics of the drink machine out to the socket. |
void |
run()
The run method loops, processing user input and requests. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private PrintWriter out
private BufferedReader in
private SundayServer server
private Socket client
| Constructor Detail |
public SundayServer.SundayClientThread(Socket inClient,
SundayServer inServer)
inClient - Reference to the client socket connectioninServer - Reference to the SundayServer object| Method Detail |
public void run()
private void dropDrink(String command,
String username)
command - The command, excluding the 'drop ' (space included).
EG: '1 2'.
private void dropRand(String command,
String username)
command - The data portion of the command that was sent to the
SundayServer.This excludes the command name and its associated
space - 'rand '.
The command should only be a single number. It should not contain
spaces.username - The name of the user who is asking to drop a random drink.
Used for accountinprivate void getStats(String command)
command - If a number is specified on the command line, only that
slot is printed.private void editUser(String command)
command - Just the command string, excludes the 'edituser ' portion
EX: 'antiduh 100 false'public void editSlot(String command)
command - Just the parameters of the command. Should be stripped of
leading spaces.
The second param must be wrapped in quotes, always.
EX: "0 "Coke" 50 43 307 true"
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||