Remote boot. java

Source: Internet
Author: User

Import java.io.IOException;

Import java.net.*;

Import java.util.*;


public class remote Boot {


public static void Main (string[] args) {


Datagramsocket ds = null; Establishment of the suite word udpsocket service


try {

ds = new Datagramsocket (9999); Instantiate a suite word, specify your own port

} catch (SocketException e) {

SYSTEM.OUT.PRINTLN ("Cannot open port!");

System.exit (1);

}

byte a = integer.valueof (0xb8). Bytevalue ();

byte B = integer.valueof (0x97). Bytevalue ();

byte C = integer.valueof (0x5a). Bytevalue ();

byte d = integer.valueof (0x68). Bytevalue ();

byte E = integer.valueof (0x64). Bytevalue ();

byte F = integer.valueof (0x6f). Bytevalue ();

byte g = integer.valueof (0xFF). Bytevalue ();

Byte[] buf= {g,g,g,g,g,g,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b , c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f,a,b,c,d,e,f , a,b,c,d,e,f,a,b,c,d,e,f};

(0XB8) (0x97) (0x5a) (0x68) (0x64) (0x6f)

InetAddress destination = null;

try {

Destination = Inetaddress.getbyname ("255.255.255.255"); Address that needs to be sent

} catch (Unknownhostexception o) {

SYSTEM.OUT.PRINTLN ("Cannot open findhost!");

System.exit (1);

}

Datagrampacket DP =

New Datagrampacket (buf, Buf.length, Destination, 9);

Packaged into the Datagrampacket type (the Datagramsocket send () method accepts this class, note that 10000 is the port that accepts the address, unlike its own port! )


try {

Ds.send (DP); Send data

} catch (IOException o) {

System.out.println (O.getmessage ());

}

Ds.close ();

}

}


Remote boot. java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.