Interface UDPCommandListener


public interface UDPCommandListener

The listener interface for receiving UDP command execution events for a particular command. A class that is interested in receiving these events must implement this interface.

The listener object that is created with a class that implements this interface should be registered using the UDPAccessor.addUDPCommandListener(java.lang.String, com.caplin.net.udp.UDPCommandListener) method. When the command is executed, the commandExecuted method will be invoked.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    commandExecuted(String[] commandArguments)
    Invoked when the command the listener is registered for is executed.
  • Method Details

    • commandExecuted

      void commandExecuted(String[] commandArguments)

      Invoked when the command the listener is registered for is executed. The arguments that were specified for the command are available from the commandArguments String array.

      If the listener has been registered multiple times for the same command, then it will be informed of a single execution of that command multiple times.

      If the listener has been registered to listen to multiple commands, then it can identify which command was executed from the first (element 0) command argument - this is always the name of the command itself.

      The listener should never try to remove itself (or any other UDPCommandlistener), or add a UDPCommandlistener within this method. If the listener needs to do this, then it should be done on a separate thread.

      Parameters:
      commandArguments - An array of the arguments with which the the command was executed. The 0th element is the command itself.