com.camelspotting.jotl.udp
Class UDPGameQuerier

java.lang.Object
  extended by com.camelspotting.jotl.udp.UDPGameQuerier
All Implemented Interfaces:
GameQuerier

public final class UDPGameQuerier
extends Object
implements GameQuerier

This is one of the primary access points for any user of the library. For each server you want to gather information from an object of this class must be instantiated. It supports both DNS and IPv4-addresses. If you use any of the constructors that have the option of not querying the server immidiately the query-metods may be used to gather information post-constructing the object.

Version:
1.0
Author:
Eivind Brandth Smedseng, Mats Andreassen
See Also:
#query(SendablePacketType pt), #queryAll()

Constructor Summary
UDPGameQuerier(String host, int fromPort, int destPort)
          Main constructor for class.
 
Method Summary
 Game getAllInformation()
          Method for getting all available information
 ClientsDetails getClientsDetails()
          Method for accessing details on the connected clients.
 Server getServer()
          Returns server related information.
 ServerDetails getServerDetails()
          Method for accessing server details.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDPGameQuerier

public UDPGameQuerier(String host,
                      int fromPort,
                      int destPort)
               throws IllegalHostException
Main constructor for class.

Parameters:
host - the hostname (openttd.someserver.com) or IPv4 to contact (ex: 127.0.0.1)
fromPort - the port to use
destPort - the port to contact
Throws:
com.camelspotting.openttd.JOTLException
IllegalHostException
Method Detail

getServerDetails

public ServerDetails getServerDetails()
                               throws JOTLException
Description copied from interface: GameQuerier
Method for accessing server details.

Specified by:
getServerDetails in interface GameQuerier
Returns:
the current ClientsInfo object or null if no info has been collected
Throws:
JOTLException

getClientsDetails

public ClientsDetails getClientsDetails()
                                 throws JOTLException
Description copied from interface: GameQuerier
Method for accessing details on the connected clients.

Specified by:
getClientsDetails in interface GameQuerier
Returns:
the current ServerInfo object or null if no info has been collected
Throws:
JOTLException

getAllInformation

public Game getAllInformation()
                       throws JOTLException
Description copied from interface: GameQuerier
Method for getting all available information

Specified by:
getAllInformation in interface GameQuerier
Returns:
a wrapper object for all current state of a game
Throws:
JOTLException

getServer

public Server getServer()
Description copied from interface: GameQuerier
Returns server related information.

Specified by:
getServer in interface GameQuerier
Returns:
an object containing server information


Copyright © 2013. All Rights Reserved.