|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ChatRoomConnection
A ChatRoomConnection is a single connection between the server and a chat room client. The Chat Room Connection encapsulates the communication between the client and the server, which can be executed on a seperate thread
Constructor Summary | |
ChatRoomConnection(java.net.Socket socket,
ChatRoomServer server)
Constructs a new ChatRoomConnection on the given socket. |
Method Summary | |
void |
close()
Closes this connection by closing the streams and the connections socket |
java.lang.String |
getHostAddress()
Returns the hostAddress for this connection |
java.lang.String |
getHostName()
Returns the hostName of this connection. |
ChatRoomServer |
getServer()
Returns the Chat Room Server. |
java.lang.String |
getUserName()
Returns the client user name for this connection |
void |
run()
Executes the task of this connection object |
void |
sendMessage(java.lang.String message)
Sends the given message through the connections output stream. |
void |
setUserName(java.lang.String userName)
Set the User name of this connection |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ChatRoomConnection(java.net.Socket socket, ChatRoomServer server)
socket
- the socket of the connection.server
- the server that serves this connectionMethod Detail |
public java.lang.String getHostName()
public java.lang.String getHostAddress()
public java.lang.String getUserName()
public void setUserName(java.lang.String userName)
userName
- the user namepublic ChatRoomServer getServer()
public void run()
run
in interface java.lang.Runnable
public void sendMessage(java.lang.String message) throws java.io.IOException
message
- a message to send.
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |