Class Cards304Client

java.lang.Object
  extended by Cards304Client

public class Cards304Client
extends java.lang.Object

This Cards304Client class represents the client actoins of this network based 304 card game. This class is mostly used to send and recieve messages to the and from the server class.


Nested Class Summary
(package private)  class Cards304Client.IncomingReader
          This IncomingReader class is to run a thread and listen to the server messages.
 
Field Summary
private  boolean connectionEstablished
           
private  Player player
           
(package private)  java.io.BufferedReader reader
           
(package private)  java.lang.Thread readerThread
           
(package private)  java.net.Socket sock
           
(package private)  java.io.PrintWriter writer
           
 
Constructor Summary
Cards304Client()
          Constructer class of Cards304Client class.
 
Method Summary
private  void cleanUp()
          This method is to terminate the connection with server.
protected  void finalize()
          This method will be called when this game exists.
 void go()
          This method is to setup the network connection with Cards304Server.
static void main(java.lang.String[] args)
           
 void send(java.lang.String msg)
          This method sends message to server.
private  boolean setUpNetworking()
          This method is to create a socket and create a network connection with the server.
 void takeAction(java.lang.String clientMsg)
          This method is to take action for server messages.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

player

private Player player

connectionEstablished

private boolean connectionEstablished

reader

java.io.BufferedReader reader

writer

java.io.PrintWriter writer

sock

java.net.Socket sock

readerThread

java.lang.Thread readerThread
Constructor Detail

Cards304Client

public Cards304Client()
Constructer class of Cards304Client class. Initiates this class and creates player object. Then, calls go method to initiate the functionalities of this class.

Method Detail

go

public void go()
This method is to setup the network connection with Cards304Server.


send

public void send(java.lang.String msg)
This method sends message to server.


setUpNetworking

private boolean setUpNetworking()
This method is to create a socket and create a network connection with the server.

Returns:
boolean success state.

cleanUp

private void cleanUp()
This method is to terminate the connection with server.


finalize

protected void finalize()
This method will be called when this game exists.

Overrides:
finalize in class java.lang.Object

takeAction

public void takeAction(java.lang.String clientMsg)
This method is to take action for server messages.


main

public static void main(java.lang.String[] args)