[plt-scheme] Wake on Lan in Scheme

From: Daniel Yoo (dyoo at cs.wpi.edu)
Date: Tue May 1 12:51:10 EDT 2007

> (define (wol-packet from to)
>  (bytes-append (string->bytes to)
>                (string->bytes from)
>                (string->bytes/utf-8 "0842") ;packet
> type is 0x0842
>                (magic-packet to)))


Hi Geb,

This looks very strange to me; I think you're misunderstanding what 
string->bytes does.  It doesn't take a string that reads as hexidecimal 
and turn it into the appropriate bytes.

That is, there's a difference between:

#############################
> (bytes #xff #xff #xff #xff)
#"\377\377\377\377"
#############################


and:

##################################
> (string->bytes/utf-8 "ffffffff")
#"ffffffff"
##################################

In the former case, we have four bytes, of which all the 8 bits of each 
byte are set to 1.  In the latter case, we have eight bytes.


Good luck!


Posted on the users mailing list.