home# tclsh
home(tclsh)#
proc WakeOnLan {broadcastAddr macAddr} {
set net [binary format H* [join [split $macAddr -:] ""]]
set pkt [binary format c* {0xff 0xff 0xff 0xff 0xff 0xff}]
for {set i 0} {$i < 16} {incr i} {
append pkt $net
}
# Open UDP and Send the Magic Paket.
set udpSock [udp_open]
fconfigure $udpSock -translation binary \
-remote [list $broadcastAddr 4580] \
-broadcast 1
puts $udpSock $pkt
flush $udpSock;
close $udpSock
}
home(tclsh)# WakeOnLan 255.255.255.255 000f13cd80a1
00:11:32:39:87:25
00:11:32:38:E8:EF
No comments:
Post a Comment