|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--info.jedi.net.MailDaemon
Class MailDaemon is the center of the JEDI system. It's function is to find the appropriate handler for incoming packets on the port it is associated with. Up to 256 handlers can be registered. Creating a MailDaemon automatically sets up threads to service incoming packets, a ResourceHandler, and handlers for Ping, Reliable, and Remote Method Call packets. The MailDaemon provides methods to get a packet of a certain type from a socket, to handle it once created, and to manage the handlers in the 256 handler slots.
PacketHandler
,
DefaultPacketHandler
,
PingHandler
,
RMCHandler
,
ReceiveThread
Field Summary | |
static int |
DEFAULT_PORT
The default port the MailDaemon is created at is 8273 |
Constructor Summary | |
MailDaemon()
Creates a MailDaemon at the default port. |
|
MailDaemon(int port)
Creates a MailDaemon at a particular port. |
Method Summary | |
void |
addHandler(PacketHandler handler,
int index)
Adds a handler to the list of packet handlers at the index given. |
static MailDaemon |
getDefault()
Returns the default MailDaemon--the last one to be created |
PingHandler |
getPingHandler()
Returns the PingHandler for this MailDaemon |
ReliableHandler |
getReliableHandler()
Returns the ReliableHandler for this MailDaemon |
RMCHandler |
getRMCHandler()
Returns the RMCHandler for this MailDaemon |
UDPSender |
getUDPSender()
Returns the UDPSender for this MailDaemon |
void |
handle(InputPacket packet)
Handles a packet until one of the handlers returns a finished flag. |
PacketHandler |
handlers(int index)
Returns the handler at the index given. |
InputPacket |
receivePacket(java.net.DatagramSocket socket,
int TYPE_TO_CATCH)
Gets a packet from a particular socket and processes it until it comes to a packet-part of type TYPE_TO_CATCH. |
ResourceHandler |
resourceHandler()
Returns the ResourceHandler associated with this MailDaemon |
void |
send(java.net.DatagramPacket packet)
Sends a packet at the socket associated with this MailDaemon. |
java.net.DatagramSocket |
socket()
Returns the socket associated with this MailDaemon |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int DEFAULT_PORT
Constructor Detail |
public MailDaemon() throws java.net.SocketException
public MailDaemon(int port) throws java.net.SocketException
port
- the port this MailDaemon will listen onMethod Detail |
public InputPacket receivePacket(java.net.DatagramSocket socket, int TYPE_TO_CATCH) throws java.io.IOException
public void handle(InputPacket packet) throws java.io.IOException
public void send(java.net.DatagramPacket packet) throws java.io.IOException
public void addHandler(PacketHandler handler, int index)
public PacketHandler handlers(int index)
public ReliableHandler getReliableHandler()
public RMCHandler getRMCHandler()
public PingHandler getPingHandler()
public java.net.DatagramSocket socket()
public ResourceHandler resourceHandler()
public UDPSender getUDPSender()
public static MailDaemon getDefault() throws java.net.SocketException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |