Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 6053744c3a3175992ac5f27cdf628e5ca01cbb57 authored by Barry Warsaw on 03 August 2010, 22:39:42 UTC
Bumping to 2.6.6 rc 1
Tip revision: 6053744
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