repo.or.cz
/
python
/
dscho.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Clarify portability and main program.
[python/dscho.git]
/
Demo
/
sockets
/
radio.py
blob
6131d40053b1fd34d6363a3c5ad6fcb0d37cc106
1
# Receive UDP packets transmitted by a broadcasting service
2
3
MYPORT
=
50000
4
5
import
sys
6
from
socket
import
*
7
8
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
9
s
.
bind
((
''
,
MYPORT
))
10
11
while
1
:
12
data
,
wherefrom
=
s
.
recvfrom
(
1500
,
0
)
13
sys
.
stderr
.
write
(
`wherefrom`
+
'
\n
'
)
14
sys
.
stdout
.
write
(
data
)