repo.or.cz
/
python.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Added updates with respect to recent changes to TimedRotatingFileHandler.
[python.git]
/
Demo
/
sockets
/
broadcast.py
blob
6d2b1e813f4833d241d1ef24f3a6b44a1ab5886a
1
# Send UDP broadcast packets
2
3
MYPORT
=
50000
4
5
import
sys
,
time
6
from
socket
import
*
7
8
s
=
socket
(
AF_INET
,
SOCK_DGRAM
)
9
s
.
bind
((
''
,
0
))
10
s
.
setsockopt
(
SOL_SOCKET
,
SO_BROADCAST
,
1
)
11
12
while
1
:
13
data
=
repr
(
time
.
time
()) +
'
\n
'
14
s
.
sendto
(
data
, (
'<broadcast>'
,
MYPORT
))
15
time
.
sleep
(
2
)