commandNetworking
Class Client

java.lang.Object
  extended by commandNetworking.Communicator
      extended by commandNetworking.Client

public class Client
extends Communicator

Client class. This class communicates with a single server given by the connected address and portnr Class inherits streams from the communicator class, but uses only one output and one inputstream


Field Summary
 boolean connected
          Boolean to check whether the client is connected or not
 
Constructor Summary
Client(java.lang.Object address, int portnr)
           
 
Method Summary
 void Connect(java.lang.Object address, int portnr)
          Connects to the server
protected  void hasConnected()
          Called after connected to the server.
 void Listen()
          Listens for messages from the server.
 void ProcessCommand(Packet command)
          Processes the ping packet only.
 void Reconnect()
          Reconnects to the server if the connection breaks down
 void Talk(Packet command)
          Sends a message to the server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connected

public boolean connected
Boolean to check whether the client is connected or not

Constructor Detail

Client

public Client(java.lang.Object address,
              int portnr)
Parameters:
address -
portnr -
Method Detail

Connect

public void Connect(java.lang.Object address,
                    int portnr)
Connects to the server

Parameters:
address -
portnr -

Reconnect

public void Reconnect()
Reconnects to the server if the connection breaks down


ProcessCommand

public void ProcessCommand(Packet command)
Processes the ping packet only. To handle other packets, this method must be overwritten

Parameters:
command -

Talk

public void Talk(Packet command)
Sends a message to the server

Overrides:
Talk in class Communicator
Parameters:
command -

Listen

public void Listen()
Listens for messages from the server. Must be called before the clients can receive messages


hasConnected

protected void hasConnected()
Called after connected to the server. May be overwritten