procedures WakeUPComputer (aMacAddress: string);
var i, j: Byte;
/ / lBuffer: array [1 .. 116] of Byte;
lBuffer: SysUtils.TBytes;
lUDPClient: TIDUDPClient;
begin
try
for i := 1 to 6 do begin
lBuffer[i] := HexToInt(aMacAddress[(i * 2) - 1] +
aMacAddress[i * 2]);
end;
lBuffer[7] := $00;
lBuffer[8] := $74;
lBuffer[9] := $FF;
lBuffer[10] := $FF;
lBuffer[11] := $FF;
lBuffer[12] := $FF;
lBuffer[13] := $FF;
lBuffer[14] := $FF;
for j := 1 to 16 do begin
for i := 1 to 6 do begin
lBuffer[15 + (j - 1) * 6 + (i - 1)] := lBuffer[i];
end;
end;
lBuffer[116] := $00;
lBuffer[115] := $40;
lBuffer[114] := $90;
lBuffer[113] := $90;
lBuffer[112] := $00;
lBuffer[111] := $40;
try
lUDPClient := TIdUDPClient.Create(nil);
lUDPClient.BroadcastEnabled := true;
lUDPClient.Host := '255.255.255.255';
lUDPClient.Port := 2050;
// d6 lUDPClient.SendBuffer(lBuffer, 116);
lUDPClient.SendBuffer(lUDPClient.Host, lUDPClient.Port, tidbytes(lBuffer));
finally
lUDPClient.Free;
end;
except
raise;
end;
end;
0 comments:
Post a Comment