|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbb.net.MagicPacket
public class MagicPacket
This class can create and send a "magic packet" to wake up another computer over the network (aka WOL).
To learn more about remote wake up, consult these links:
http://support.intel.com/support/network/sb/CS-008459.htm http://www.madge.com/_assets/downloads/lsshelp8.0/LSSHelp/AdvFeat/WonLAN/WonLAN2.htm http://searchnetworking.techtarget.com/sDefinition/0,,sid7_gci214609,00.html http://www.dslreports.com/faq/wol http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/wol-mini-howto-3.html#ss3.2Note that you will likely have to configure the target computer to allow its NIC to wake up the computer. On 2004/4/2 on Lily's Win2k laptop, here is the configuration that was required:
This class was inspired by the following magic packet programs:
C: http://www.rom-o-matic.net/5.0.4/contrib/wakeonlan/wol.c Java: http://www.java-internals.com/code/ Python: http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/wolpython.txt
This class is multithread safe: it is immutable (both its immediate state, as well as the deep state of its fields).
Nested Class Summary | |
---|---|
static class |
MagicPacket.UnitTest
See the Overview page of the project's javadocs for a general description of this unit test class. |
Field Summary | |
---|---|
static int |
port_default
Default port value to send the magic packet to. |
Constructor Summary | |
---|---|
private |
MagicPacket()
This sole private constructor suppresses the default (public) constructor, ensuring non-instantiability outside of this class. |
Method Summary | |
---|---|
private static byte[] |
magicPacketData(EthernetMacAddress ethernetMacAddress)
|
static void |
send(EthernetMacAddress ethernetMacAddress,
InetAddress inetAddress)
Simply calls . |
static void |
send(EthernetMacAddress ethernetMacAddress,
InetAddress inetAddress,
int port)
Sends the "magic packet" data (constructed from ethernetMacAddress) to inetAddress at port. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int port_default
Constructor Detail |
---|
private MagicPacket()
Method Detail |
---|
public static void send(EthernetMacAddress ethernetMacAddress, InetAddress inetAddress) throws IllegalArgumentException, SocketException, SecurityException, IOException
send
(ethernetMacAddress, inetAddress, port_default)
.
IllegalArgumentException
SocketException
SecurityException
IOException
public static void send(EthernetMacAddress ethernetMacAddress, InetAddress inetAddress, int port) throws IllegalArgumentException, SocketException, SecurityException, IOException
IllegalArgumentException
- if ethernetMacAddress == null; inetAddress == null; port is an invalid value
SocketException
- if a DatagramSocket could not be opened, or the socket could not bind to the specified local port
SecurityException
- if a security manager exists and its checkListen method doesn't allow the operation
IOException
- if an I/O problem occursprivate static byte[] magicPacketData(EthernetMacAddress ethernetMacAddress)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |