لدي HTPC and a network server on my network. My server is always on, ولكن HTPC sleeps when it is not in use. If I want to schedule recordings remotely I need a way to wake the HTPC. The solution I came up with is to provide a webpage on my server (كلمة السر المحمية) أن يستيقظ ل HTPC ثم الموجهات إلى واجهة ويب من التطبيق التحكم عن بعد لل HTPC. Below is the code for anyone interested…
[php language=“htmlscript”]<أتش تي أم أل>
<رئيس>
<meta http-equiv=‘refresh’ content=’11;url=address of htpc here’ />
<script type=“text/javascript”>
// time is the number of seconds left
// name is the text part of the container to insert countdown in
// num is the unique id of the container. Allows for more than 1 per page
function countdown(زمن, اسم, num)
{
// grab the element object of the countdown container
countdownDiv = document.getElementById(name + num);
// calculate number of minutes from the seconds
minutes = Math.floor(time / 60);
// remainder is number of seconds
seconds = time % 60;
// add the current countdown display to the container specified
countdownDiv.innerHTML = ‘after ’ + ثواني + ’ seconds, please wait’;
إذا(time == 1)countdownDiv.innerHTML = ‘after ’ + ثواني + ’ second, please wait’;
// if time is up remove the edit div, otherwise repeat every second
إذا(زمن <= 0) countdownDiv.innerHTML = ‘now…’;
else setTimeout(‘countdown(‘ + –time + ‘,“ ‘ + اسم + ’ ”,“ ‘ + num + ‘”);’, 1000);
}
</سيناريو>
</رئيس>
<body bgcolor=‘#000022’ style=‘text-align: center; color: أبيض; padding-top: 30بكسل;’>
<h2>
ال تلفزيون interface will automatically load <div id=“div_name1” style=“display:inline;"></شعبة>
<script type=“text/javascript”>countdown(12, “div_name”, 1)</سيناريو>
</h2>
<?فب
flush();
$addr_byte = explode(‘:’, “MAC Address of htpc here”);
$hw_addr = ”;
إلى ($a=0; $ا <6; $a++) $hw_addr .= chr(hexdec($addr_byte[$ا]));
$msg = chr(255).chr(255).chr(255).chr(255).chr(255).chr(255);
إلى ($a = 1; $ا <= 16; $a++) $msg .= $hw_addr;
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$opt_ret = socket_set_option($ق, 1, 6, TRUE);
إذا(socket_sendto($ق, $msg, strlen($msg), 0, “local subnet address here”, “7”)) {socket_close($ق);return TRUE;}آخر {return FALSE;}
?>
</الجسم>
</أتش تي أم أل>[/فب]
“Hi James I realise it has been a long while, but I just checked this on windows 11 (build 23H2)…”