unicast pendant for broadcast.py

This commit is contained in:
Guido van Rossum 1996-08-21 20:11:55 +00:00
parent 171191efb2
commit 4ec060ad28
1 changed files with 16 additions and 0 deletions

16
Demo/sockets/unicast.py Normal file
View File

@ -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)