File: radio.py

package info (click to toggle)
python2.5 2.5-5%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 52,452 kB
  • ctags: 96,908
  • sloc: ansic: 352,790; python: 317,047; sh: 17,465; asm: 6,564; makefile: 4,300; lisp: 3,678; perl: 3,674; xml: 894; objc: 756; sed: 2
file content (14 lines) | stat: -rwxr-xr-x 287 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
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)