~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Demo/sockets/unicast.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 = repr(time.time()) + '\n'
 
13
    s.sendto(data, ('', MYPORT))
 
14
    time.sleep(2)