summaryrefslogtreecommitdiff
path: root/Demo/sockets
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-08-21 20:11:55 +0000
committerGuido van Rossum <guido@python.org>1996-08-21 20:11:55 +0000
commit2d44df62d60a83326523be00e301b43ca8f438a1 (patch)
tree65d949d6db77e7293ca181236278cf196212afd5 /Demo/sockets
parent46a03f2641315eb0a643f66fb6e68c99f25f3962 (diff)
downloadcpython-2d44df62d60a83326523be00e301b43ca8f438a1.tar.gz
unicast pendant for broadcast.py
Diffstat (limited to 'Demo/sockets')
-rw-r--r--Demo/sockets/unicast.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Demo/sockets/unicast.py b/Demo/sockets/unicast.py
new file mode 100644
index 0000000000..1e9caebd2a
--- /dev/null
+++ b/Demo/sockets/unicast.py
@@ -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)
+
+