Package org.opentrafficsim.sim0mq.swing
Class PublisherDemo
java.lang.Object
org.opentrafficsim.sim0mq.swing.PublisherDemo
Experiment with the Sim0MQPublisher.
Copyright (c) 2020-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Thread that runs a PublisherExperiment.(package private) static class
Repeatedly try to read all available messages. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Test code.static byte[][]
readMessages
(org.zeromq.ZMQ.Socket socket) Read as many messages from a ZMQ socket as are available.(package private) static void
sendCommand
(org.zeromq.ZMQ.Socket socket, byte[] message) Wrapper for ZMQ.Socket.send that may output some debugging information.
-
Method Details
-
main
public static void main(String[] args) throws IOException, nl.tudelft.simulation.dsol.SimRuntimeException, NamingException, nl.tudelft.simulation.language.DsolException, org.opentrafficsim.draw.OtsDrawingException, org.sim0mq.Sim0MQException, org.djutils.serialization.SerializationException, InterruptedException Test code.- Parameters:
args
- String[]; the command line arguments (not used)- Throws:
IOException
- ...NamingException
- ...nl.tudelft.simulation.dsol.SimRuntimeException
- ...nl.tudelft.simulation.language.DsolException
- ...org.opentrafficsim.draw.OtsDrawingException
- ...org.djutils.serialization.SerializationException
- ...org.sim0mq.Sim0MQException
- ...InterruptedException
- ...
-
sendCommand
static void sendCommand(org.zeromq.ZMQ.Socket socket, byte[] message) Wrapper for ZMQ.Socket.send that may output some debugging information.- Parameters:
socket
- ZMQ.Socket; the socket to send ontomessage
- byte[]; the message to transmit
-
readMessages
public static byte[][] readMessages(org.zeromq.ZMQ.Socket socket) Read as many messages from a ZMQ socket as are available. Do NOT block when there are no (more) messages to read.- Parameters:
socket
- ZMQ.Socket; the socket- Returns:
- byte[][]; the read messages
-