Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: a7077c865d76afe0bc9640ec0b8f2aa6c0df6f4b authored by Barry Warsaw on 16 August 2010, 22:58:18 UTC
Move NEWS file entry.
Tip revision: a7077c8
unicast.py
# Send UDP broadcast packets

MYPORT = 50000

import sys, time
from socket import *

s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))

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