nl.bluering.ppracing
Class NetClient

java.lang.Object
  |
  +--nl.bluering.ppracing.NetClient

public class NetClient
extends java.lang.Object

This class provides the functionality for playing a network game as client. It takes care of the communication with the server


Field Summary
static int PORT
           
 
Constructor Summary
NetClient(java.lang.String server, Ppracing p, java.lang.String n, newnetwindow nw)
          Creates a new client and connects to the server on port 8192
 
Method Summary
 void endgame()
          Is called when the endgame-signal is received
 int getid()
           
 java.lang.String[] getplayerlist()
           
 int[] getplayertype()
           
 void incircuit(java.lang.String s)
          Loads the circuit send by the server
 void indisconnect()
          Is called when the server disconnects this client
 void inid(int i)
          Gives this client an id number
 void inmessage(java.lang.String s)
          Is called when a message is received from the server
 void inmove(java.lang.String s)
          Receives the current player's move from the server
 void inname(java.lang.String[] n)
          Is called when a list of players is recieved from the server
 void outdisconnect()
          Disconnects this client from the server
 void outmessage(java.lang.String s)
          Sends a message to the server
 void outmove(int m)
          Sends this clients' move to the server
 void outname()
          Sends this clients' name to the server
 void showmessage(java.lang.String s)
          Shows the incoming message in the chatbox of the newnetwindow
 void startgame()
          Is called when the startgame-signal is received
 void stop()
          Stops all in/outcoming connections
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT

public static final int PORT
Constructor Detail

NetClient

public NetClient(java.lang.String server,
                 Ppracing p,
                 java.lang.String n,
                 newnetwindow nw)
          throws java.io.IOException
Creates a new client and connects to the server on port 8192
Method Detail

inid

public void inid(int i)
Gives this client an id number

getid

public int getid()
Returns:
the client ID

outname

public void outname()
Sends this clients' name to the server

inname

public void inname(java.lang.String[] n)
Is called when a list of players is recieved from the server

outmessage

public void outmessage(java.lang.String s)
Sends a message to the server

inmessage

public void inmessage(java.lang.String s)
Is called when a message is received from the server

outmove

public void outmove(int m)
Sends this clients' move to the server

inmove

public void inmove(java.lang.String s)
Receives the current player's move from the server

startgame

public void startgame()
Is called when the startgame-signal is received

endgame

public void endgame()
Is called when the endgame-signal is received

indisconnect

public void indisconnect()
Is called when the server disconnects this client

outdisconnect

public void outdisconnect()
Disconnects this client from the server

incircuit

public void incircuit(java.lang.String s)
Loads the circuit send by the server

stop

public void stop()
Stops all in/outcoming connections

getplayerlist

public java.lang.String[] getplayerlist()
Returns:
The list of currently connected players

getplayertype

public int[] getplayertype()
Returns:
The list of types of the connected players

showmessage

public void showmessage(java.lang.String s)
Shows the incoming message in the chatbox of the newnetwindow