Package org.zeromq
Class ZBeacon
java.lang.Object
org.zeromq.ZBeacon
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classThe broadcast client periodically sends beacons via UDP to the network.private classThe broadcast server receives beacons.static classstatic interfaceAll beacons with matching prefix are passed to a listener. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference<byte[]> private final ZBeacon.BroadcastClientprivate final AtomicLongprivate final ZBeacon.BroadcastServerprivate static final byte[]static final Stringstatic final longprivate final AtomicReference<ZBeacon.Listener> private final AtomicReference<byte[]> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]longbyte[]voidsetBeacon(byte[] beacon) voidsetBroadcastInterval(long broadcastInterval) voidsetListener(ZBeacon.Listener listener) voidsetPrefix(byte[] prefix) voidsetUncaughtExceptionHandlers(Thread.UncaughtExceptionHandler clientHandler, Thread.UncaughtExceptionHandler serverHandler) voidstart()voidvoidvoidstop()
-
Field Details
-
DEFAULT_BROADCAST_INTERVAL
public static final long DEFAULT_BROADCAST_INTERVAL- See Also:
-
DEFAULT_BROADCAST_HOST
- See Also:
-
DEFAULT_BROADCAST_ADDRESS
private static final byte[] DEFAULT_BROADCAST_ADDRESS -
broadcastClient
-
broadcastServer
-
prefix
-
beacon
-
broadcastInterval
-
listener
-
clientHandler
-
serverHandler
-
-
Constructor Details
-
ZBeacon
public ZBeacon(int port, byte[] beacon) -
ZBeacon
-
ZBeacon
-
ZBeacon
-
ZBeacon
public ZBeacon(String broadcastAddress, byte[] serverAddress, int port, byte[] beacon, long broadcastInterval, boolean ignoreLocalAddress, boolean blocking)
-
-
Method Details
-
setUncaughtExceptionHandlers
public void setUncaughtExceptionHandlers(Thread.UncaughtExceptionHandler clientHandler, Thread.UncaughtExceptionHandler serverHandler) -
startClient
public void startClient() -
startServer
public void startServer() -
start
public void start() -
stop
- Throws:
InterruptedException
-
setBeacon
public void setBeacon(byte[] beacon) -
getBeacon
public byte[] getBeacon() -
setPrefix
public void setPrefix(byte[] prefix) -
getPrefix
public byte[] getPrefix() -
setListener
-
getListener
-
getBroadcastInterval
public long getBroadcastInterval() -
setBroadcastInterval
public void setBroadcastInterval(long broadcastInterval)
-