diff options
| author | Guido van Rossum <guido@python.org> | 1992-05-19 13:52:02 +0000 | 
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 1992-05-19 13:52:02 +0000 | 
| commit | b83ec8f58de07a3c5ba53342b19670a96dcd254d (patch) | |
| tree | 46d9c39dbc0f8c9f1cf001cff4e5cc1624861383 /Demo/sockets/broadcast.py | |
| parent | c99a4f900d1feb2f3be88949b766bb81ca0ccf08 (diff) | |
| download | cpython-git-b83ec8f58de07a3c5ba53342b19670a96dcd254d.tar.gz | |
Initial revision
Diffstat (limited to 'Demo/sockets/broadcast.py')
| -rwxr-xr-x | Demo/sockets/broadcast.py | 17 | 
1 files changed, 17 insertions, 0 deletions
diff --git a/Demo/sockets/broadcast.py b/Demo/sockets/broadcast.py new file mode 100755 index 0000000000..9ed900f0c6 --- /dev/null +++ b/Demo/sockets/broadcast.py @@ -0,0 +1,17 @@ +# Send UDP broadcast packets + +MYPORT = 50000 + +import sys, time +from socket import * + +s = socket(AF_INET, SOCK_DGRAM) +s.bind('', 0) +s.allowbroadcast(1) + +while 1: +	data = `time.time()` + '\n' +	s.sendto(data, ('<broadcast>', MYPORT)) +	time.sleep(2) + +	  | 
