Class EIEIOConnection

java.lang.Object
uk.ac.manchester.spinnaker.connections.UDPConnection<EIEIOMessage<? extends EIEIOHeader>>
uk.ac.manchester.spinnaker.connections.EIEIOConnection
All Implemented Interfaces:
Closeable, AutoCloseable, Connection

public class EIEIOConnection extends UDPConnection<EIEIOMessage<? extends EIEIOHeader>>
A UDP connection for sending and receiving raw EIEIO messages.
  • Constructor Details

    • EIEIOConnection

      public EIEIOConnection(InetAddress localHost, Integer localPort) throws IOException
      Create an EIEIO connection only available for listening.
      Parameters:
      localHost - The local IP address to bind to. If not specified, it defaults to binding to all interfaces, unless remoteHost is specified, in which case binding is done to the IP address that will be used to send packets.
      localPort - The local port to bind to, 0 or between 1025 and 65535.
      Throws:
      IOException - If there is an error setting up the communication channel
  • Method Details

    • sendEIEIOMessage

      public void sendEIEIOMessage(EIEIOMessage<?> eieioMessage) throws IOException
      Sends an EIEIO message down this connection.
      Parameters:
      eieioMessage - The EIEIO message to be sent
      Throws:
      IOException - If there is an error sending the message
    • sendCommand

      protected void sendCommand(int command) throws IOException
      Send a raw command.
      Parameters:
      command - The command to send.
      Throws:
      IOException - If sending fails.
    • sendCommand

      protected void sendCommand(EIEIOCommand command) throws IOException
      Send a raw command.
      Parameters:
      command - The command to send.
      Throws:
      IOException - If sending fails.
    • sendCommand

      protected void sendCommand(EIEIOCommand command, InetAddress ipAddress, int port) throws IOException
      Send a raw command.
      Parameters:
      command - The command to send.
      ipAddress - The host to send to.
      port - The port to send to.
      Throws:
      IOException - If sending fails.
    • receiveCommand

      protected EIEIOCommand receiveCommand() throws IOException, InterruptedException
      Receive a raw command.
      Returns:
      the command ID
      Throws:
      IOException - If receiving fails.
      InterruptedException - If communications are interrupted.
    • sendEIEIOMessageTo

      public void sendEIEIOMessageTo(EIEIOMessage<? extends EIEIOHeader> eieioMessage, InetAddress ipAddress, int port) throws IOException
      Send an EIEIO message to a specific destination.
      Parameters:
      eieioMessage - The message to send.
      ipAddress - The host to send to.
      port - The port to send to.
      Throws:
      IOException - If anything goes wrong in sending.
    • receiveMessage

      public EIEIOMessage<? extends EIEIOHeader> receiveMessage(int timeout) throws IOException, InterruptedException
      Description copied from class: UDPConnection
      Receives a SpiNNaker message from this connection. Blocks until a message has been received, or a timeout occurs.
      Specified by:
      receiveMessage in class UDPConnection<EIEIOMessage<? extends EIEIOHeader>>
      Parameters:
      timeout - The time in seconds to wait for the message to arrive, or until the connection is closed.
      Returns:
      the received message
      Throws:
      IOException - If there is an error receiving the message
      SocketTimeoutException - If there is a timeout during receiving
      InterruptedException - If communications are interrupted.