Package org.zeromq
Class ZBeacon
java.lang.Object
org.zeromq.ZBeacon
This class implements a peer-to-peer discovery service for local networks.
A beacon can broadcast and/or capture service announcements using UDP messages
on the local area network. This implementation uses IPv4 UDP broadcasts. You can
define the format of your outgoing beacons, and set a filter that validates incoming
beacons. Beacons are sent and received asynchronously in the background.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
All beacons with matching prefix are passed to a listener. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionZBeacon
(int port, byte[] beacon) ZBeacon
(String broadcastAddress, byte[] serverAddress, int port, byte[] beacon, long broadcastInterval, boolean ignoreLocalAddress, boolean blocking) Deprecated.ZBeacon
(InetAddress broadcastAddress, InetAddress serverAddress, int port, byte[] beacon, long broadcastInterval, boolean ignoreLocalAddress, boolean blocking) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
long
byte[]
void
setBeacon
(byte[] beacon) Deprecated.use the buildervoid
setBroadcastInterval
(long broadcastInterval) void
setListener
(ZBeacon.Listener listener) Deprecated.use the buildervoid
setPrefix
(byte[] prefix) Deprecated.use the buildervoid
setUncaughtExceptionHandlers
(Thread.UncaughtExceptionHandler clientExHandler, Thread.UncaughtExceptionHandler serverExHandler) Deprecated.use the buildervoid
start()
void
void
void
stop()
-
Field Details
-
DEFAULT_BROADCAST_INTERVAL
public static final long DEFAULT_BROADCAST_INTERVAL- See Also:
-
DEFAULT_BROADCAST_HOST
- See Also:
-
-
Constructor Details
-
ZBeacon
public ZBeacon(int port, byte[] beacon) -
ZBeacon
-
ZBeacon
-
ZBeacon
-
ZBeacon
public ZBeacon(InetAddress broadcastAddress, InetAddress serverAddress, int port, byte[] beacon, long broadcastInterval, boolean ignoreLocalAddress, boolean blocking) -
ZBeacon
@Deprecated public ZBeacon(String broadcastAddress, byte[] serverAddress, int port, byte[] beacon, long broadcastInterval, boolean ignoreLocalAddress, boolean blocking) Deprecated.
-
-
Method Details
-
setUncaughtExceptionHandlers
@Deprecated public void setUncaughtExceptionHandlers(Thread.UncaughtExceptionHandler clientExHandler, Thread.UncaughtExceptionHandler serverExHandler) Deprecated.use the builder- Parameters:
clientExHandler
-serverExHandler
-
-
startClient
public void startClient() -
startServer
public void startServer() -
start
public void start() -
stop
- Throws:
InterruptedException
-
setBeacon
Deprecated.use the builder- Parameters:
beacon
-
-
getBeacon
public byte[] getBeacon() -
setPrefix
Deprecated.use the builder- Parameters:
prefix
-
-
getPrefix
public byte[] getPrefix() -
setListener
Deprecated.use the builder- Parameters:
listener
-
-
getListener
-
getBroadcastInterval
public long getBroadcastInterval() -
setBroadcastInterval
public void setBroadcastInterval(long broadcastInterval)
-