org.globalse.arena.frag.peers
Class PeerConnectionServer

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.globalse.arena.frag.peers.PeerConnectionServer

public class PeerConnectionServer
extends java.lang.Thread
implements ServiceListener

The class PeerConnectionServer sets up a Server for incoming connections, at a specified port. It adds the incoming connection to peers in PeerManager.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
PeerConnectionServer(PeerManager peerManager, int portNumber, java.lang.String password)
          A new PeerConnectionServer is set up.
 
Method Summary
 void addService(Rendezvous rendezvous, java.lang.String type, java.lang.String name)
          Called when a new Service is detected
 void removeService(Rendezvous rendezvous, java.lang.String type, java.lang.String name)
          Called when a Service is removed
 void run()
          Starting the Thread starts the PeerConnectionServer.
 void shutDown()
          Shutdown the PeerConnectionServer.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, 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

PeerConnectionServer

public PeerConnectionServer(PeerManager peerManager,
                            int portNumber,
                            java.lang.String password)
A new PeerConnectionServer is set up.
Parameters:
password - String the password for joining game. "" means no password.
peerManager - The peerManager, that is currently used
portNumber - The portNumber to listen
Method Detail

addService

public void addService(Rendezvous rendezvous,
                       java.lang.String type,
                       java.lang.String name)
Called when a new Service is detected
Specified by:
addService in interface ServiceListener
Parameters:
rendezvous - Rendezvous instance of the peer subsystem for finding peers.
type - String is the type for finding peer's. e.g. arena.tcp_local
name - String name of the service

removeService

public void removeService(Rendezvous rendezvous,
                          java.lang.String type,
                          java.lang.String name)
Called when a Service is removed
Specified by:
removeService in interface ServiceListener
Parameters:
rendezvous - Rendezvous peer subsystem for finding games.
type - String e.g. arena.tcp_local
name - String name of the service

run

public void run()
Starting the Thread starts the PeerConnectionServer.
Overrides:
run in class java.lang.Thread
See Also:
Runnable.run()

shutDown

public void shutDown()
Shutdown the PeerConnectionServer.



This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)