UDP broadcasts => 'Permission denied'
Guido Goldstein
clpy at a-nugget.de
Mon Nov 4 18:34:36 EST 2002
Hi!
On Mon, 4 Nov 2002 23:47:51 +0100
Christian Kaenzig <christian at becool.ch> wrote:
[...]
> But then I wanted the client not to send its data explicitely to the server,
> but send a broadcast packet instead, so I told the client to send it to
> '<broadcast>'. This didn't work :-(. It printed the folowing message :
>
> s.sendto('Hello world',(HOST, PORT))
> socket.error: (13, 'Permission denied')
[...]
Try the following:
--- cut ---
if hasattr(socket,'SO_BROADCAST'):
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto('Hello world',(HOST, PORT))
--- cut ---
This allows broadcast messages going out from the given socket.
HIH
Guido
More information about the Python-list
mailing list