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
-
Nested Class Summary
Nested classes/interfaces inherited from class uk.ac.manchester.spinnaker.connections.UDPConnection
UDPConnection.TrafficClass
-
Method Summary
Modifier and Type Method Description protected void
connectedReceiverTask()
Core SpiNNaker message receive and dispatch-to-websocket loop.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.Optional<ByteBuffer>
receiveMessage(int timeout)
Receives a SpiNNaker message from this connection.void
sendMessage(ByteBuffer msg)
Send a message on this connection.void
sendMessage(ByteBuffer msg, InetAddress addr, int port)
Send a message on this connection.String
toString()
protected void
writeCountsToLog()
Writes the count of messages sent and received on this connection to the log.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
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
-
Method Details
-
receiveMessage
Receives a SpiNNaker message from this connection. Blocks until a message has been received, or a timeout occurs.- Specified by:
receiveMessage
in classUDPConnection<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 messageSocketTimeoutException
- If there is a timeout during receivingInterruptedException
- If communications are interrupted.
-
sendMessage
Send a message on this connection.- Parameters:
msg
- The message to send.- Throws:
IOException
- If sending fails.
-
sendMessage
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
- Overrides:
toString
in classUDPConnection<Optional<ByteBuffer>>
-
connectedReceiverTask
protected void connectedReceiverTask()Core SpiNNaker message receive and dispatch-to-websocket loop. -
eieioReceiverTask
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.
-