net.barkerjr.gameserver
Class UdpServer

java.lang.Object
  extended by net.barkerjr.gameserver.Base
      extended by net.barkerjr.gameserver.GameServer
          extended by net.barkerjr.gameserver.UdpServer
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
GameSpyServer, UnrealEngine2Server, ValveServer

public abstract class UdpServer
extends GameServer
implements Closeable

Provides generic parsing and querying servers via UDP

Since:
2007-10-25
Author:
BarkerJr

Nested Class Summary
 
Nested classes/interfaces inherited from class net.barkerjr.gameserver.GameServer
GameServer.Dedicated, GameServer.Request, GameServer.RequestTimeoutException
 
Field Summary
protected static Map<InetSocketAddress,UdpServer> servers
          The servers which are active
 
Fields inherited from class net.barkerjr.gameserver.GameServer
address, botCount, dedicated, gameDirectory, IPTOS_RELIABILITY, map, maximumPlayers, name, namespace, numberOfPlayers, passwordRequired, players, plugins, rules, updated, version
 
Fields inherited from class net.barkerjr.gameserver.Base
listeners
 
Constructor Summary
UdpServer(InetAddress ip, int port)
          Deprecated. since 2007-11-10, use UdpServer(InetSocketAddress)
UdpServer(InetSocketAddress address)
          Sets up the basic server information and DOM
 
Method Summary
 void close()
          Removes internal references to this server
protected abstract  void parseData(byte[] data)
          Parses the given data
protected  void sendData(byte[] data)
          Sends the given data to the server
protected  void sendData(String data)
          Sends the given data to the server
 
Methods inherited from class net.barkerjr.gameserver.GameServer
addPlugin, equals, fireChangeEvent, fireLoadEvent, getBotCount, getDedicated, getGameDirectory, getIP, getMap, getMaximumPlayers, getName, getNumberOfPlayers, getPlayers, getPlugins, getPort, getRules, getUpdated, getVersion, handleError, hashCode, isPasswordRequired, load, load, replaceChild, toJsonObject, toString, toXmlDocument
 
Methods inherited from class net.barkerjr.gameserver.Base
addListener, removeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

servers

protected static final Map<InetSocketAddress,UdpServer> servers
The servers which are active

Since:
2007-11-18
Constructor Detail

UdpServer

@Deprecated
public UdpServer(InetAddress ip,
                            int port)
Deprecated. since 2007-11-10, use UdpServer(InetSocketAddress)

Sets up the basic server information and DOM

Parameters:
ip - the IP address of the server
port - the port of the server
Since:
2007-10-25

UdpServer

public UdpServer(InetSocketAddress address)
Sets up the basic server information and DOM

Parameters:
address - the address of the server
Since:
2007-11-10
Method Detail

parseData

protected abstract void parseData(byte[] data)
                           throws IOException
Parses the given data

Parameters:
data - the bytes in the packet
Throws:
IOException - if there is a problem
Since:
2007-11-10

close

public void close()
Removes internal references to this server

Specified by:
close in interface Closeable
Since:
2007-10-25

sendData

protected void sendData(String data)
                 throws IOException
Sends the given data to the server

Parameters:
data - the data to send
Throws:
IOException - if there was an error sending the request
Since:
2007-11-18

sendData

protected void sendData(byte[] data)
                 throws IOException
Sends the given data to the server

Parameters:
data - the data to send
Throws:
IOException - if there was an error sending the request
Since:
2007-10-25