Package org.zeromq
Class ZBeacon
java.lang.Object
org.zeromq.ZBeacon
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
The broadcast client periodically sends beacons via UDP to the network.private class
The broadcast server receives beacons.static class
static interface
All beacons with matching prefix are passed to a listener. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference<byte[]>
private final ZBeacon.BroadcastClient
private final AtomicLong
private final ZBeacon.BroadcastServer
private static final byte[]
static final String
static final long
private final AtomicReference<ZBeacon.Listener>
private final AtomicReference<byte[]>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
long
byte[]
void
setBeacon
(byte[] beacon) void
setBroadcastInterval
(long broadcastInterval) void
setListener
(ZBeacon.Listener listener) void
setPrefix
(byte[] prefix) void
setUncaughtExceptionHandlers
(Thread.UncaughtExceptionHandler clientHandler, Thread.UncaughtExceptionHandler serverHandler) void
start()
void
void
void
stop()
-
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)
-