client
Class ChatClient

java.lang.Object
  |
  +--ocsf.client.AbstractClient
        |
        +--client.ChatClient

public class ChatClient
extends AbstractClient

This class overrides some of the methods defined in the abstract superclass in order to give more functionality to the client.


Field Summary
(package private)  ChatIF clientUI
          The interface type variable.
 
Fields inherited from class ocsf.client.AbstractClient
clientReader, clientSocket, host, input, output, port, readyToStop
 
Constructor Summary
ChatClient(java.lang.String host, int port, ChatIF clientUI)
          Constructs an instance of the chat client.
 
Method Summary
 void handleMessageFromClientUI(java.lang.String message)
          This method handles all data coming from the UI
 void handleMessageFromServer(java.lang.Object msg)
          This method handles all data that comes in from the server.
 void quit()
          This method terminates the client.
 
Methods inherited from class ocsf.client.AbstractClient
closeAll, closeConnection, connectionClosed, connectionEstablished, connectionException, getHost, getInetAddress, getPort, isConnected, openConnection, run, sendToServer, setHost, setPort
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

clientUI

ChatIF clientUI
The interface type variable. It allows the implementation of the display method in the client.
Constructor Detail

ChatClient

public ChatClient(java.lang.String host,
                  int port,
                  ChatIF clientUI)
           throws java.io.IOException
Constructs an instance of the chat client.
Parameters:
host - The server to connect to.
port - The port number to connect on.
clientUI - The interface type variable.
Method Detail

handleMessageFromServer

public void handleMessageFromServer(java.lang.Object msg)
This method handles all data that comes in from the server.
Parameters:
msg - The message from the server.
Overrides:
handleMessageFromServer in class AbstractClient

handleMessageFromClientUI

public void handleMessageFromClientUI(java.lang.String message)
This method handles all data coming from the UI
Parameters:
message - The message from the UI.

quit

public void quit()
This method terminates the client.