diff options
Diffstat (limited to 'AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/radio.py')
-rw-r--r-- | AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/radio.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/radio.py b/AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/radio.py new file mode 100644 index 0000000000..084ef88ca9 --- /dev/null +++ b/AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/radio.py @@ -0,0 +1,14 @@ +# Receive UDP packets transmitted by a broadcasting service
+
+MYPORT = 50000
+
+import sys
+from socket import *
+
+s = socket(AF_INET, SOCK_DGRAM)
+s.bind(('', MYPORT))
+
+while 1:
+ data, wherefrom = s.recvfrom(1500, 0)
+ sys.stderr.write(repr(wherefrom) + '\n')
+ sys.stdout.write(data)
|