Class Receiver

java.lang.Object
  extended byjava.lang.Thread
      extended byReceiver
All Implemented Interfaces:
java.lang.Runnable

public class Receiver
extends java.lang.Thread

Receives obstacle positions via TCP after obtaining the server IP address and port through multicast message. Recieves game play messages via a multicast socket. Uses the data in the messages to update an associated sector display.


Field Summary
(package private)  boolean flag
           
(package private)  java.net.InetAddress home
           
(package private)  int homePort
           
(package private)  java.net.MulticastSocket multiSock
           
(package private) static int OBSTACLE_SERVER_WAIT_TIME
           
(package private)  Sector sector
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Receiver(Sector sector, int homePort)
           
 
Method Summary
 void finalize()
          Closes streams and sockets and stops the receiving thread.
 void initializeObstacles()
           
 void run()
          Run method for the receiving thread.
 
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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sector

Sector sector

OBSTACLE_SERVER_WAIT_TIME

static final int OBSTACLE_SERVER_WAIT_TIME
See Also:
Constant Field Values

home

java.net.InetAddress home

homePort

int homePort

multiSock

java.net.MulticastSocket multiSock

flag

boolean flag
Constructor Detail

Receiver

public Receiver(Sector sector,
                int homePort)
Parameters:
sector - object to which changes will be applied
Method Detail

initializeObstacles

public void initializeObstacles()

run

public void run()
Run method for the receiving thread. Repeatedly receive messages and applies the information they contain to the sector.


finalize

public void finalize()
Closes streams and sockets and stops the receiving thread.