Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 84471935ed2f62b8c5758fd544c7d37076fe0fa5 authored by Benjamin Peterson on 16 September 2017, 17:38:35 UTC
2.7.14 final version bumps
Tip revision: 8447193
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