Class ProxyUDPConnection

java.lang.Object
uk.ac.manchester.spinnaker.connections.UDPConnection<Optional<ByteBuffer>>
uk.ac.manchester.spinnaker.alloc.proxy.ProxyUDPConnection
All Implemented Interfaces:
Closeable, AutoCloseable, Connection

public class ProxyUDPConnection extends UDPConnection<Optional<ByteBuffer>>
The low-level handler for proxy connections.
Author:
Donal Fellows
  • Method Details

    • receiveMessage

      public Optional<ByteBuffer> receiveMessage(int timeout) throws IOException, InterruptedException
      Receives a SpiNNaker message from this connection. Blocks until a message has been received, or a timeout occurs.
      Specified by:
      receiveMessage in class UDPConnection<Optional<ByteBuffer>>
      Parameters:
      timeout - The time in seconds to wait for the message to arrive, or until the connection is closed.
      Returns:
      The wrapped message bytes, or Optional.empty() if the socket timed out (not an error!)
      Throws:
      IOException - If there is an error receiving the message
      SocketTimeoutException - If there is a timeout during receiving
      InterruptedException - If communications are interrupted.
    • sendMessage

      public void sendMessage(ByteBuffer msg) throws IOException
      Send a message on this connection.
      Parameters:
      msg - The message to send.
      Throws:
      IOException - If sending fails.
    • sendMessage

      public void sendMessage(ByteBuffer msg, InetAddress addr, int port) throws IOException
      Send a message on this connection.
      Parameters:
      msg - The message to send.
      addr - Where to send to.
      port - What port to send to.
      Throws:
      IOException - If sending fails.
    • writeCountsToLog

      protected void writeCountsToLog()
      Writes the count of messages sent and received on this connection to the log.
    • toString

      public String toString()
      Overrides:
      toString in class UDPConnection<Optional<ByteBuffer>>
    • connectedReceiverTask

      protected void connectedReceiverTask()
      Core SpiNNaker message receive and dispatch-to-websocket loop.
    • eieioReceiverTask

      protected void eieioReceiverTask(Set<InetAddress> recvFrom)
      Core SpiNNaker message receive and dispatch-to-websocket loop for the type of connections required for EIEIO, especially for the live packet gatherer, which does a complex muxing and programs sockets/tags in a different way.
      Parameters:
      recvFrom - What hosts we are allowed to receive messages from. Messages from elsewhere will be discarded.