Class MulticastListener

  • All Implemented Interfaces:
    java.lang.Runnable

    public class MulticastListener
    extends java.lang.Object
    implements java.lang.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

      Constructors 
      Constructor Description
      MulticastListener​(int multicastPort, java.lang.String multicastGroup, byte[] expectedMessage, byte[] returnMessage)
      Creates a multicast listener on the specified multicast port, bound to the specified multicast group.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void run()
      Run method waits for Multicast packets with the specified contents and replies with the specified message.
      void stopListener()
      Waits for datagram listener to finish, with a timeout.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MulticastListener

        public MulticastListener​(int multicastPort,
                                 java.lang.String multicastGroup,
                                 byte[] expectedMessage,
                                 byte[] returnMessage)
                          throws java.io.IOException,
                                 java.net.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 for
        returnMessage - the message to reply with
        Throws:
        java.io.IOException
        java.net.UnknownHostException
    • Method Detail

      • run

        public void run()
        Run method waits for Multicast packets with the specified contents and replies with the specified message.
        Specified by:
        run in interface java.lang.Runnable
      • stopListener

        public void stopListener()
        Waits for datagram listener to finish, with a timeout.