Class Thermometer.Receiver

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    Thermometer

    private class Thermometer.Receiver
    extends java.lang.Object
    implements java.lang.Runnable
    Receiver listens for multicast packets from the TemperatureSender?? program and stores that information in the appropriate channel.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean runFlag
      Run flag used to stop the main thread
      private java.net.MulticastSocket socket
      Multicast socket to receive data from the TemperatureSender?? program
      private java.lang.Thread thread
      Main thread
    • Constructor Summary

      Constructors 
      Constructor Description
      Receiver()
      Create a new Receiver object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void run()
      Receives the data packets from the TemperatureSender?? programs and updates the appropriate Channel objects with current data.
      void start()
      Sets the runFlag to true and starts the main thread running if it has not yet been started
      void stop()
      Sets the runFlag to false and closes the multicast socket to stop the main thread.
      • Methods inherited from class java.lang.Object

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

      • thread

        private final java.lang.Thread thread
        Main thread
      • runFlag

        private volatile boolean runFlag
        Run flag used to stop the main thread
      • socket

        private java.net.MulticastSocket socket
        Multicast socket to receive data from the TemperatureSender?? program
    • Constructor Detail

      • Receiver

        public Receiver()
        Create a new Receiver object
    • Method Detail

      • start

        public void start()
        Sets the runFlag to true and starts the main thread running if it has not yet been started
      • run

        public void run()
        Receives the data packets from the TemperatureSender?? programs and updates the appropriate Channel objects with current data.
        Specified by:
        run in interface java.lang.Runnable
      • stop

        public void stop()
        Sets the runFlag to false and closes the multicast socket to stop the main thread.