Package wol

Class WakeUpUtil


  • public class WakeUpUtil
    extends Object
    A class to wake up wake-on-lan enabled machines.
    Author:
    Steffen Moldaner
    • Field Detail

      • DEFAULT_HOST

        public static final InetAddress DEFAULT_HOST
        The default wakeup host: 255.255.255.255 (limited broadcast address).
      • DEFAULT_PORT

        public static final int DEFAULT_PORT
        The default wakeup port: 9
        See Also:
        Constant Field Values
    • Method Detail

      • wakeup

        public static void wakeup​(EthernetAddress ethernetAddress)
                           throws IOException
        Wakes up the machine with the provided ethernet address, using the default port and host.
        Parameters:
        ethernetAddress - the ethernet address to wake up
        Throws:
        IOException - if an I/O error occurs
        See Also:
        DEFAULT_HOST, DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress[] ethernetAddresses)
                           throws IOException
        Wakes up the machines with the provided ethernet addresses, using the default port and host.
        Parameters:
        ethernetAddresses - the ethernet addresses to wake up
        Throws:
        IOException - if an I/O error occurs
        See Also:
        DEFAULT_HOST, DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress ethernetAddress,
                                  InetAddress host)
                           throws IOException
        Wakes up the machine with the provided ethernet addresses, using the default port.
        Parameters:
        ethernetAddress - the ethernet address to wake up
        host - the host, the magic sequence will be send to
        Throws:
        IOException - if an I/O error occurs
        See Also:
        DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress[] ethernetAddresses,
                                  InetAddress host)
                           throws IOException
        Wakes up the machines with provided ethernet address. Equal to WakeUpUtil.wakeup(ethernetAddresses, host, DEFAULT_PORT);
        Parameters:
        ethernetAddresses - the ethernet addresses to wake up
        host - the host, the magic sequence will be send to
        Throws:
        IOException - if an I/O error occurs
        See Also:
        DEFAULT_PORT
      • wakeup

        public static void wakeup​(EthernetAddress ethernetAddress,
                                  InetAddress host,
                                  int port)
                           throws IOException
        Wakes up the machines with provided ethernet address. Equal to wakeup(new EthernetAddress[]{ethernetAddress}, host, port);
        Parameters:
        ethernetAddress - the ethernet address to wake up
        host - the host, the magic sequence will be send to
        port - the port number
        Throws:
        IOException - if an I/O error occurs
        See Also:
        wakeup(EthernetAddress[], InetAddress, int)
      • wakeup

        public static void wakeup​(EthernetAddress[] ethernetAddresses,
                                  InetAddress host,
                                  int port)
                           throws IOException
        Wakes up the machines with provided ethernet addresses. The magic sequences are sent to the given host and port.
        Parameters:
        ethernetAddresses - the ethernet addresses to wake up
        host - the host, the magic sequence will be send to
        port - the port number
        Throws:
        IOException - if an I/O error occurs
      • createWakeupFrame

        protected static byte[] createWakeupFrame​(EthernetAddress ethernetAddress)
        Creates the byte representation of a wakeupframe for the given ethernet address.
        Parameters:
        ethernetAddress - the ethernet address
        Returns:
        a byte representation of the wakeupframe