python wol code
python wol code
#!/usr/bin/python
from socket import socket, AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_BROADCAST
data = '\xFF\xFF\xFF\xFF\xFF\xFF' + '\xAA\xAA\xAA\xAA\xAA\xAA' * 16
sock = socket(AF_INET, SOCK_DGRAM)
sock.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
sock.sendto(data, ('<broadcast>', 9))
sock.close()
ref : http://blog.stalkr.net/2009/12/wake-on-lan-in-python.html
0개의 덧글:
댓글 쓰기
에 가입 댓글 [Atom]
<< 홈