Interface UdpBindingService

All Superinterfaces:
com.google.common.util.concurrent.Service
All Known Implementing Classes:
UdpBindingServiceImpl

public interface UdpBindingService extends com.google.common.util.concurrent.Service
Service to receive and send UDP messages.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service

    com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sends a UDP message given as parameter to the connected UDP socket.
    void
    Sets a message receiver callback to fetch any messages from the UDP socket.

    Methods inherited from interface com.google.common.util.concurrent.Service

    addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
  • Method Details

    • setMessageReceiver

      void setMessageReceiver(UdpMessageReceiverCallback receiver)
      Sets a message receiver callback to fetch any messages from the UDP socket.

      A received message contains the payload as well as sender address and port.

      Parameters:
      receiver - the message receiver to set.
    • sendMessage

      void sendMessage(UdpMessage message) throws IOException, TransportException
      Sends a UDP message given as parameter to the connected UDP socket.

      The function blocks until the message is sent.

      Parameters:
      message - the message to send. The message shall contain host and port of the receiver in case of unicast; multicast does not need transport information as those are stored in the binding service.
      Throws:
      IOException - on any IO problem.
      TransportException - in case the message lacks address information and no multicast socket is found.