Package com.toxi.net
Class UDPSyncServer
java.lang.Object
com.toxi.net.UDPSyncServer
An MPE inspired synch server for networked multi-screen applications. All communication is realised via UDP. Clients are not requested to acknowledge every single packet received, but need to send a heart beat in a regular (configurable) interval. The server discards any data received from clients, so it doesn't matter what is being sent back. A single byte will suffice.
The server can be configured via CLI arguments and/or Java property files and can be connected to an existing logger. When run on from the commandline a console logger is automatically added.
- Author:
- Karsten Schmidt <info@postspectacular.com>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(TypedProperties config) Configures the server with settings using the passed-in properties.void
Main entry point for CLI.int
int
static void
void
run()
Main server loop/state machine.void
setListener
(ServerListener listener) Attaches an event listener to the server.void
Attaches a logger to the server.void
setMaxReceivePacketSize
(int size) Sets the max.void
setNumClients
(int numClients) Sets the number of clients the server is expecting and initially waiting for to connect before any syncing begins.
-
Constructor Details
-
UDPSyncServer
public UDPSyncServer()
-
-
Method Details
-
main
-
execute
Main entry point for CLI.- Parameters:
args
- command line arguments
-
configure
Configures the server with settings using the passed-in properties.- Parameters:
config
-
-
run
public void run()Main server loop/state machine. Creates socket and handles syncing of connected clients. -
getMaxPacketSize
public int getMaxPacketSize()- Returns:
- Maximum size of UDP packets the server is able to receive
-
setMaxReceivePacketSize
public void setMaxReceivePacketSize(int size) Sets the max. size of UDP packets the server is able to receive- Parameters:
size
-
-
getNumClients
public int getNumClients()- Returns:
- configured number of clients the server is expecting and initially waiting for to connect before any syncing begins.
-
setNumClients
public void setNumClients(int numClients) Sets the number of clients the server is expecting and initially waiting for to connect before any syncing begins.- Parameters:
numClients
-
-
setLogger
Attaches a logger to the server.- Parameters:
logger
-
-
setListener
Attaches an event listener to the server.- Parameters:
listener
-
-