Staging
v0.5.1
https://github.com/python/cpython
Revision bde67df0cd4de5e034c2cf4bd43c0d5657649942 authored by Benjamin Peterson on 22 June 2010, 18:09:02 UTC, committed by Benjamin Peterson on 22 June 2010, 18:09:02 UTC
Be generous in abc.py to allow this.
1 parent 3ceab01
Raw File
Tip revision: bde67df0cd4de5e034c2cf4bd43c0d5657649942 authored by Benjamin Peterson on 22 June 2010, 18:09:02 UTC
keep UserDict an old-style class
Tip revision: bde67df
broadcast.py
# Send UDP broadcast packets

MYPORT = 50000

import sys, time
from socket import *

s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)

while 1:
    data = repr(time.time()) + '\n'
    s.sendto(data, ('<broadcast>', MYPORT))
    time.sleep(2)
back to top