home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Languages / Python / python-14-src / Demo / sockets / unicast.py < prev   
Encoding:
Python Source  |  1997-01-17  |  220 b   |  17 lines

  1. # Send UDP broadcast packets
  2.  
  3. MYPORT = 50000
  4.  
  5. import sys, time
  6. from socket import *
  7.  
  8. s = socket(AF_INET, SOCK_DGRAM)
  9. s.bind(('', 0))
  10.  
  11. while 1:
  12.     data = `time.time()` + '\n'
  13.     s.sendto(data, ('', MYPORT))
  14.     time.sleep(2)
  15.  
  16.     
  17.