mirror of
https://github.com/python/cpython.git
synced 2024-12-13 11:54:54 +08:00
9c6bd77e39
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78779 | benjamin.peterson | 2010-03-07 20:11:06 -0600 (Sun, 07 Mar 2010) | 1 line remove svn:executable from scripts without a shebang line ........
15 lines
287 B
Python
15 lines
287 B
Python
# 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)
|