none
如何实现web开机 RRS feed

  • 问题

  •  

    我想通过web实现远程开机,请问怎么办呢?

     

    我查了一些资料说AMD公司的一款软件可以,大概原理也知道了,只是有些不明白,就是如何通过mac地址产生数据包,产生什么样的数据包,有没有相关的程序可以参照一下?谢谢

    2008年12月25日 6:38

答案

  •  

         byte[] mac=new byteDevil{0x00,0x16,0xEC,0x4E,0xFD,0x15};
               
                 byte[] packet = new byte[17 * 6];

                 for (int i = 0; i < 6; i++)
                 {
                     packetIdea = 0xFF;
                 }

                 for (int i = 1; i <= 16; i++)
                 {
                     for (int j = 0; j < 6; j++)
                     {
                         packet[i * 6 + j] = mac[j];
                     }
                 }

                 int port = 30000;
                 IPAddress IPAd = IPAddress.Broadcast;
                 IPEndPoint ip = new IPEndPoint(IPAd, port);
                 EndPoint ep = (EndPoint)ip;
                 Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                 sock.Connect(ep);
                 if (sock.Connected)
                 {
                     if (sock.Poll(-1, SelectMode.SelectWrite))
                     {                   
                         int s = sock.Send(packet);
                         if (s > 0)
                         {
                           
                         }
                     }
                 }

    2008年12月25日 7:05

全部回复

  •  

         byte[] mac=new byteDevil{0x00,0x16,0xEC,0x4E,0xFD,0x15};
               
                 byte[] packet = new byte[17 * 6];

                 for (int i = 0; i < 6; i++)
                 {
                     packetIdea = 0xFF;
                 }

                 for (int i = 1; i <= 16; i++)
                 {
                     for (int j = 0; j < 6; j++)
                     {
                         packet[i * 6 + j] = mac[j];
                     }
                 }

                 int port = 30000;
                 IPAddress IPAd = IPAddress.Broadcast;
                 IPEndPoint ip = new IPEndPoint(IPAd, port);
                 EndPoint ep = (EndPoint)ip;
                 Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                 sock.Connect(ep);
                 if (sock.Connected)
                 {
                     if (sock.Poll(-1, SelectMode.SelectWrite))
                     {                   
                         int s = sock.Send(packet);
                         if (s > 0)
                         {
                           
                         }
                     }
                 }

    2008年12月25日 7:05
  •  

    远程开机????  楼主,我是没听说过的

     

    真的能行?,我到时想见识一下。

    2008年12月26日 5:58
    版主