source: vendor/python/2.5/Demo/sockets/radio.py

Last change on this file was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 287 bytes
RevLine 
[3225]1# Receive UDP packets transmitted by a broadcasting service
2
3MYPORT = 50000
4
5import sys
6from socket import *
7
8s = socket(AF_INET, SOCK_DGRAM)
9s.bind(('', MYPORT))
10
11while 1:
12 data, wherefrom = s.recvfrom(1500, 0)
13 sys.stderr.write(repr(wherefrom) + '\n')
14 sys.stdout.write(data)
Note: See TracBrowser for help on using the repository browser.