Class BootConnection
java.lang.Object
uk.ac.manchester.spinnaker.connections.UDPConnection<BootMessage>
uk.ac.manchester.spinnaker.connections.BootConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connection
public class BootConnection extends UDPConnection<BootMessage>
A connection to the SpiNNaker board that uses UDP for booting.
-
Nested Class Summary
Nested classes/interfaces inherited from class uk.ac.manchester.spinnaker.connections.UDPConnection
UDPConnection.TrafficClass
-
Constructor Summary
Constructors Constructor Description BootConnection(InetAddress localHost, Integer localPort, InetAddress remoteHost, Integer remotePort)
Creates a boot connection. -
Method Summary
Modifier and Type Method Description BootMessage
receiveMessage(int timeout)
Receives a SpiNNaker message from this connection.void
sendBootMessage(BootMessage bootMessage)
Sends a SpiNNaker boot message using this connection.Methods inherited from class uk.ac.manchester.spinnaker.connections.UDPConnection
close, doReceive, doReceiveWithAddress, doSend, doSendTo, getLocalAddress, getLocalIPAddress, getLocalPort, getRemoteAddress, getRemoteIPAddress, getRemotePort, isClosed, isConnected, receive, receive, receiveMessage, receiveWithAddress, send, send, sendPortTriggerMessage, sendTo, sendTo, sendTo, setReceivePacketSize, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface uk.ac.manchester.spinnaker.connections.model.Connection
convertTimeout
-
Constructor Details
-
BootConnection
public BootConnection(InetAddress localHost, Integer localPort, InetAddress remoteHost, Integer remotePort) throws IOExceptionCreates a boot connection.- Parameters:
localHost
- The local host to bind to. Ifnull
defaults to bind 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, between 1025 and 32767. Ifnull
, defaults to a random unused local portremoteHost
- The remote host to send packets to. Ifnull
, the socket will be available for listening only, and will throw and exception if used for sendingremotePort
- The remote port to send packets to. Ifnull
, a default value is used.- Throws:
IOException
- If there is an error setting up the communication channel
-
-
Method Details
-
receiveMessage
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 classUDPConnection<BootMessage>
- 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 messageSocketTimeoutException
- If there is a timeout during receivingInterruptedException
- If communications are interrupted.
-
sendBootMessage
Sends a SpiNNaker boot message using this connection.- Parameters:
bootMessage
- The message to be sent- Throws:
IOException
- If there is an error sending the message
-