Damir Hakimov wrote: >Hi All! > >I'm writing a small programm which must send and service UDP broadcast >packets. >As start of it I looked at >/usr/share/doc/python2.4/Examples/Demo/sockets/broadcast.py > > > > Well, this is the broken code (from examples): ----------------------------------------------------------------------------------- MYPORT = 50000 import sys, time from socket import * s = socket(AF_INET, SOCK_DGRAM) s.bind(('', 0)) s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) while 1: data = repr(time.time()) + '\n' s.sendto(data, ('<broadcast>', MYPORT)) time.sleep(2) ----------------------------------------------------------------------------------- And this is a Traceback (most recent call last):
File "broadcast.py", line 14, in ? s.sendto(data, ('<broadcast>', MYPORT)) socket.error: (101, 'Network is unreachable') If I replace '<broadcast>' to '192.168.10.255' (this is my network's broadcast addres) it's working fine. Were is the truble? Damir. -- http://mail.python.org/mailman/listinfo/python-list