Package com.toxi.net

Class UDPSyncServer

java.lang.Object
com.toxi.net.UDPSyncServer

public class UDPSyncServer extends Object

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 Details

    • UDPSyncServer

      public UDPSyncServer()
  • Method Details

    • main

      public static void main(String[] args)
    • execute

      public void execute(String[] args)
      Main entry point for CLI.
      Parameters:
      args - command line arguments
    • configure

      public void configure(TypedProperties config)
      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

      public void setLogger(Logger logger)
      Attaches a logger to the server.
      Parameters:
      logger -
    • setListener

      public void setListener(ServerListener listener)
      Attaches an event listener to the server.
      Parameters:
      listener -