|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectServerCommandHandler
Class ServerCommandHandler handles the server commands.
The user of the server can give it commands in the console.
ServerCommandHandler takes care of receiving and handling these
commands.
Server| Field Summary | |
private Server |
s
|
| Constructor Summary | |
ServerCommandHandler(Server srv)
Constructor. |
|
| Method Summary | |
protected void |
kickAll()
Kicks all the players out from the server. |
protected void |
kickPlayer(int id)
Kicks the given player out from the server. |
protected void |
printHelp()
Prints out helpful text. |
protected void |
printPlayers()
Prints out the players currently connected to the server. |
protected void |
printTracks()
Prints out the tracks that are currently played. |
void |
readParams(java.lang.String command,
java.util.StringTokenizer st)
Handles parameters belonging to some commands. |
void |
run()
A loop that waits for commands from the console and when they arrive calls the correct method for them. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Server s
| Constructor Detail |
public ServerCommandHandler(Server srv)
srv - Server whose commands we are handling| Method Detail |
public void run()
To exit the loop and close the server, command "exit" should be used.
public void readParams(java.lang.String command,
java.util.StringTokenizer st)
command - the given commandst - StringTokenizer to read the parametersprotected void printHelp()
protected void printPlayers()
protected void printTracks()
protected void kickAll()
protected void kickPlayer(int id)
id - id of the player to kick out
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||