Staging
v0.5.1
https://github.com/python/cpython
Revision bd371a4cbb0cdf4fb2b726134747c3ea062c5321 authored by Barry Warsaw on 17 March 2012, 22:19:15 UTC, committed by Barry Warsaw on 17 March 2012, 22:19:15 UTC
1 parent 2875b5b
Raw File
Tip revision: bd371a4cbb0cdf4fb2b726134747c3ea062c5321 authored by Barry Warsaw on 17 March 2012, 22:19:15 UTC
Bump to 2.6.8rc2
Tip revision: bd371a4
radio.py
# 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)
back to top