nl.bluering.ppracing
Class NetSend

java.lang.Object
  |
  +--nl.bluering.ppracing.NetSend
All Implemented Interfaces:
java.lang.Runnable

public class NetSend
extends java.lang.Object
implements java.lang.Runnable

This class implements the procedures for sending data from the server or a client


Constructor Summary
NetSend(java.net.Socket s, int i, NetClient n)
          Creates a new sendingplatform for a client
NetSend(java.net.Socket s, int i, NetSClient n)
          Creates a new sendingplatform for the server
 
Method Summary
 void acknowledge()
          Sends acknowledgement with ID to the client
 void carmove(java.lang.String s)
          Sends a move to the server or players
 void circuit(java.lang.String s)
          The server sends the circuit to the client
 void disconnect()
          Disconnects client from server
 void endgame(java.lang.String s)
          The server ends the current game
 void message(java.lang.String s)
          Sends a message to the server or each player
 void newgame()
          The server starts a new game
 void players(java.lang.String[] s)
          Sends playerlist to each client
 void run()
          Is called when the thread is started This function attempts to send the message 30 times, then cancelles the action
 void send(java.lang.String t, java.lang.String m)
          Tells this class to start sending the new message.
 void sendname(java.lang.String s)
          Sends the clients name to the server
 void setid(int id)
          Resets the client id to the new value
 void setname(java.lang.String s)
          The client sends it's name to the server
 void start()
          Function to start this thread, must be called once
 void stop()
          Stops this thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetSend

public NetSend(java.net.Socket s,
               int i,
               NetClient n)
Creates a new sendingplatform for a client

NetSend

public NetSend(java.net.Socket s,
               int i,
               NetSClient n)
Creates a new sendingplatform for the server
Method Detail

start

public void start()
Function to start this thread, must be called once

send

public void send(java.lang.String t,
                 java.lang.String m)
Tells this class to start sending the new message. It waits until the previous operation is finished.

stop

public void stop()
Stops this thread

setid

public void setid(int id)
Resets the client id to the new value

run

public void run()
Is called when the thread is started This function attempts to send the message 30 times, then cancelles the action
Specified by:
run in interface java.lang.Runnable

acknowledge

public void acknowledge()
Sends acknowledgement with ID to the client

disconnect

public void disconnect()
Disconnects client from server

players

public void players(java.lang.String[] s)
Sends playerlist to each client

sendname

public void sendname(java.lang.String s)
Sends the clients name to the server

message

public void message(java.lang.String s)
Sends a message to the server or each player

newgame

public void newgame()
The server starts a new game

carmove

public void carmove(java.lang.String s)
Sends a move to the server or players

endgame

public void endgame(java.lang.String s)
The server ends the current game

setname

public void setname(java.lang.String s)
The client sends it's name to the server

circuit

public void circuit(java.lang.String s)
The server sends the circuit to the client