Package com.toxi.net
Class ServerListenerAdapter
java.lang.Object
com.toxi.net.ServerListenerAdapter
- All Implemented Interfaces:
ServerListener
- Author:
- toxi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clientConnected
(com.toxi.net.UDPConnection conn) Notifies listener of a new client connection.void
clientDisconnected
(com.toxi.net.UDPConnection conn) Notifies listener a client has disconnected.void
clientUpdated
(com.toxi.net.UDPConnection conn, DatagramPacket receivePacket) Notifies and forwards received client data to the listener for further analysis.byte[]
Gives the listener a chance to add extra data to the payload packet distributed to each client.void
Gives listener a chance to react to any fatal server errors.void
Notifies the listener server is shutting down.void
Notifies listener immediately after the server socket has been created.void
Notifies the listener of a new server state.
-
Constructor Details
-
ServerListenerAdapter
public ServerListenerAdapter()
-
-
Method Details
-
clientConnected
public void clientConnected(com.toxi.net.UDPConnection conn) Description copied from interface:ServerListener
Notifies listener of a new client connection. Details are attached.- Specified by:
clientConnected
in interfaceServerListener
-
clientDisconnected
public void clientDisconnected(com.toxi.net.UDPConnection conn) Description copied from interface:ServerListener
Notifies listener a client has disconnected. Connection details are attached.- Specified by:
clientDisconnected
in interfaceServerListener
-
clientUpdated
Description copied from interface:ServerListener
Notifies and forwards received client data to the listener for further analysis.- Specified by:
clientUpdated
in interfaceServerListener
- Parameters:
conn
- client connection detailsreceivePacket
- data sent by the client
-
getSyncPayload
public byte[] getSyncPayload()Description copied from interface:ServerListener
Gives the listener a chance to add extra data to the payload packet distributed to each client.- Specified by:
getSyncPayload
in interfaceServerListener
- Returns:
- additional data, or null if none required
-
serverError
Description copied from interface:ServerListener
Gives listener a chance to react to any fatal server errors.- Specified by:
serverError
in interfaceServerListener
-
serverShutdown
public void serverShutdown()Description copied from interface:ServerListener
Notifies the listener server is shutting down.- Specified by:
serverShutdown
in interfaceServerListener
-
serverStarted
public void serverStarted()Description copied from interface:ServerListener
Notifies listener immediately after the server socket has been created.- Specified by:
serverStarted
in interfaceServerListener
-
serverStateChanged
Description copied from interface:ServerListener
Notifies the listener of a new server state. The state info itself is attached.- Specified by:
serverStateChanged
in interfaceServerListener
-