Package com.dalsemi.onewire.adapter
Class MulticastListener
java.lang.Object
com.dalsemi.onewire.adapter.MulticastListener
- All Implemented Interfaces:
Runnable
Generic Mulitcast broadcast listener. Listens for a specific message and, in
response, gives the specified reply. Used by NetAdapterHost for automatic
discovery of host components for the network-based DSPortAdapter.
-
Constructor Summary
ConstructorDescriptionMulticastListener
(int multicastPort, String multicastGroup, byte[] expectedMessage, byte[] returnMessage) Creates a multicast listener on the specified multicast port, bound to the specified multicast group. -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
Run method waits for Multicast packets with the specified contents and replies with the specified message.void
Waits for datagram listener to finish, with a timeout.
-
Constructor Details
-
MulticastListener
public MulticastListener(int multicastPort, String multicastGroup, byte[] expectedMessage, byte[] returnMessage) throws IOException, UnknownHostException Creates a multicast listener on the specified multicast port, bound to the specified multicast group. Whenever the byte[] pattern specified by "expectedMessage" is received, the byte[] pattern specified by "returnMessage" is sent to the sender of the "expected message".- Parameters:
multicastPort
- Port to bind this listener to.multicastGroup
- Group to bind this listener to.expectedMessage
- the message to look forreturnMessage
- the message to reply with- Throws:
IOException
UnknownHostException
-
-
Method Details