sv.net
Class NetDaemon

java.lang.Object
  extended byjava.lang.Thread
      extended bysv.net.NetDaemon
All Implemented Interfaces:
java.lang.Runnable

public class NetDaemon
extends java.lang.Thread


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NetDaemon()
           
 
Method Summary
 void closeDown()
          Close connection with other computer.
 boolean establishConnection()
          Try to establish connection with oter instance; hostname an port have to be set
 void run()
           
 int sendName(java.lang.String n)
           
 int sendReady()
           
 void setController(Controller c)
          Set instance of the controller of the running game; maybe necessary to communicate while playing
 void setGame(Game g)
          Set instance of running game; maybe necessary to communicate while playing
 void setHost(java.lang.String s)
          Set adress of other instance
 void setPort(int i)
          Set the port number, on which the other instance is listening
 int shoot(int x, int y)
           
 int syncAmmo(int a)
           
 boolean waitForConnection()
          Waits for connection on set port.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetDaemon

public NetDaemon()
Method Detail

setHost

public void setHost(java.lang.String s)
Set adress of other instance

Parameters:
s - adress of another computer (either ip adress or url)

setPort

public void setPort(int i)
Set the port number, on which the other instance is listening

Parameters:
i - port number

setGame

public void setGame(Game g)
Set instance of running game; maybe necessary to communicate while playing

Parameters:
g - Instance of Game

setController

public void setController(Controller c)
Set instance of the controller of the running game; maybe necessary to communicate while playing

Parameters:
c -

establishConnection

public boolean establishConnection()
Try to establish connection with oter instance; hostname an port have to be set

Returns:
true, if connection was established succesfully

waitForConnection

public boolean waitForConnection()
Waits for connection on set port.

Returns:
true, if connection was established succesfully.

shoot

public int shoot(int x,
                 int y)

syncAmmo

public int syncAmmo(int a)

sendReady

public int sendReady()

sendName

public int sendName(java.lang.String n)

run

public void run()

closeDown

public void closeDown()
Close connection with other computer.