Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: d1dd2e307c92184423d3602f663054cdc49c62bd authored by Barry Warsaw on 18 March 2010, 22:14:36 UTC
Bumping to 2.6.5 final.
Tip revision: d1dd2e3
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