|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ChatRoomServer
A Chat Room Server that handles up to 50 user simultaneously in the room.
Constructor Summary | |
ChatRoomServer()
Constructs a new ChatRoomServer on port 9090. |
|
ChatRoomServer(int serverPort)
Constructs a new ChatRoomServer on a specific port. |
Method Summary | |
java.util.Vector |
getConnections()
Returns the current server connections. |
int |
getNumberOfConnections()
Returns the number of online connections. |
void |
handleDisconnection(ChatRoomConnection connection)
handles the disconnection of a user. |
boolean |
isConnected()
Returns true if the server is connected; false otherwise. |
void |
logError(java.lang.String message)
logs an Error to the Server log. |
void |
logMessage(java.lang.String message)
logs a message to the Server log. |
void |
run()
Runs this thread |
void |
sendToAllUsers(java.lang.String message)
Sends the given message to all the connected users |
void |
setLogger(ChatRoomServerUI log)
Sets the logger of this server |
void |
start()
Starts the server |
void |
stop()
Stops the server |
void |
updateUI()
Called to update the ui whenever the connections of the server has changed (added or removed connections) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ChatRoomServer()
public ChatRoomServer(int serverPort)
Method Detail |
public void start()
public void stop()
public boolean isConnected()
public void setLogger(ChatRoomServerUI log)
log
- The ChatRoomServerUI loggerpublic java.util.Vector getConnections()
public int getNumberOfConnections()
public void run()
run
in interface java.lang.Runnable
public void handleDisconnection(ChatRoomConnection connection) throws java.io.IOException
java.io.IOException
public void sendToAllUsers(java.lang.String message) throws java.io.IOException
java.io.IOException
public void logMessage(java.lang.String message)
message
- The message to log.public void logError(java.lang.String message)
message
- The message to log.public void updateUI()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |