|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinf1010.pusle.chat.client.ChatClient
public class ChatClient
A simple chat client for Puslegruppa.
Constructor Summary | |
---|---|
ChatClient(java.lang.String server,
int port,
java.lang.String user)
Create a ChatClient and connect it to a server. |
Method Summary | |
---|---|
void |
addChatListener(ChatListener listener)
Changes this client's ChatListener. |
boolean |
handleMessage(Message m)
Handles incoming packets not handled by other ChatListeners. |
static void |
main(java.lang.String[] args)
Entry point. |
void |
run()
Listen to the socket until the socket gets closed. |
void |
sendMessage(java.lang.String msg)
Sends a chat message to the server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChatClient(java.lang.String server, int port, java.lang.String user)
server
- the server to connect to.port
- the port number to use.user
- the username to use in the chat.Method Detail |
---|
public static void main(java.lang.String[] args)
args
- command line args: public boolean handleMessage(Message m) throws java.io.IOException
handleMessage
in interface ChatListener
m
- the packet to handle.
java.io.IOException
- if sending error messages to the user fails.public void sendMessage(java.lang.String msg)
msg
- the message to send to the server.public void addChatListener(ChatListener listener)
listener
- the new ChatListener to handle received messages.public void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |