Remote awakening computer

xiaoxiao2021-03-06  131

Public int sendpacket (String Mac1, String Mac2, String Mac3, String Mac4, String Mac5, String Mac6) ?? {???? ??? // Return Value: 0 Successfully issued. -1, error has a MAC address, -2 transmits an error. ??? system.net.sockets.udpclient? M_client = new system.net.sockets.udpclient (); ??? Byte [] msg = new byte [102]; ??? for (int i = 0; i < = 5; i ) ??? {???? msg [i] = 0xff; ???} ??? try ??? {???? for (int K = 6; k <= 96; k = K 6) ???? {????? INT T1 = Convert.Toint32 (Mac1, 16); ????? msg [k 0] = (Byte) T1;

????? INT T2 = Convert.TOINT32 (Mac2, 16); ????? msg [k 1] = (byte) T2;

????? INT T3 = Convert.Toint32 (Mac3, 16); ????? msg [k 2] = (Byte) T3;

????? INT T4 = Convert.Toint32 (Mac4, 16); ????? msg [k 3] = (Byte) T4;

????? INT T5 = Convert.Toint32 (Mac5, 16); ????? msg [k 4] = (byte) T5;

????? INT T6 = Convert.Toint32 (Mac6, 16); ????? msg [k 5] = (byte) T6; ????} ???} ??? catch ??? {???? Return -1; ???} ??? // broadcast in the local area network ??? for (int i = 0; i <3; i ) ??? {???? TRY??? ? {????? ipndpoint pendide? = New iPadpoint (iPaddress.Broadcast, 623); ?? ?????? Int ecode =? M_client.send (msg, msg.length, ipndpoint); ???? } ???? catch ???? {????? Return-2; ????} ???}? ??? system.threading.thread.sleep (3000); ??????? ???? Return 0; ??}

转载请注明原文地址:https://www.9cbs.com/read-127485.html

New Post(0)