mirror of https://github.com/python/cpython.git
unicast pendant for broadcast.py
This commit is contained in:
parent
171191efb2
commit
4ec060ad28
|
@ -0,0 +1,16 @@
|
|||
# Send UDP broadcast packets
|
||||
|
||||
MYPORT = 50000
|
||||
|
||||
import sys, time
|
||||
from socket import *
|
||||
|
||||
s = socket(AF_INET, SOCK_DGRAM)
|
||||
s.bind(('', 0))
|
||||
|
||||
while 1:
|
||||
data = `time.time()` + '\n'
|
||||
s.sendto(data, ('', MYPORT))
|
||||
time.sleep(2)
|
||||
|
||||
|
Loading…
Reference in New Issue