[plt-scheme] Wake on Lan in Scheme
Thank you Daniel and Geoffrey for all your help.
I have one more question in the code below dealing
with the parameters passed to socket-sendmsg. Since
the machine is not on , it doesn't yet have an
ip-address so what do I send the msg to - a machine
address? and also how do I indicate that it should be
broadcast on port 9? I realize that the socket is
already set for that, but the python code reiterates
the broadcast information.
Thanks for all the help,
Dan
;; here is the second iteration... now I am having a
problem with
;socket-sendmsg
(require (planet "socket.ss" ("vyzo" "socket.plt" 1
2)))
(define pc02 (bytes #x00 #x13 #x72 #xA2 #xB0 #x96))
(define (repeat mac n)
(cond
[(= n 0) (bytes )]
[else
(bytes-append mac (repeat mac (sub1 n)))]))
(define (magic-packet mac)
(let ((mac (repeat mac 16)))
(bytes-append (bytes #xFF #xFF #xFF #xFF #xFF #xFF)
mac)))
(define msg (magic-packet pc02))
(define s (socket PF_INET SOCK_DGRAM))
(socket-setsockopt s SOL_SOCKET SO_BROADCAST #t)
(socket-sendmsg s
... ??is this a machine address
because the machine is not turned on??
msg
... ??How do I indicate that this is
broadcast??
)
(socket-close s)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com