feud.clientserver
Class ServerBrowser

java.lang.Object
  extended byfeud.clientserver.ServerBrowser

public class ServerBrowser
extends java.lang.Object

Simple server browser that listens on a specified UDP port for servers broadcasting their connection data on that port.


Constructor Summary
ServerBrowser(int port)
          Creates a new ServerBrowser that will listen on a speficied UDP-port for servers to broadcast their data.
 
Method Summary
 void addListener(DataChangeListener listener)
          Adds a new DataChangesListener to the browser.
 java.util.List getServerList()
          Returns the current list of servers that this browser has found.
 void startBrowser()
          Starts the browser.
 void stopBrowser()
          Stops the browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerBrowser

public ServerBrowser(int port)
Creates a new ServerBrowser that will listen on a speficied UDP-port for servers to broadcast their data. This prepares the browser, it doesn't start it.

Parameters:
port - the UDP port to use
Method Detail

addListener

public void addListener(DataChangeListener listener)
Adds a new DataChangesListener to the browser. The listener will be notified if the server list changes, i.e. if servers get removed or added.

Parameters:
listener - the listener

startBrowser

public void startBrowser()
Starts the browser.


stopBrowser

public void stopBrowser()
Stops the browser.


getServerList

public java.util.List getServerList()
Returns the current list of servers that this browser has found.

Returns:
List the server list