python broadcast socket

Grant Edwards grante at visi.com
Wed Jun 29 10:05:44 EDT 2005


On 2005-06-29, <ronpro at cox.net> <ronpro at cox.net> wrote:

> I'm sort of new to both Python and socket programming so I
> appologize ahead of time if this is a dumb question.  I have
> found that the following code works on windows but on linux I
> get an exception.
>
> import socket
> s = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
> s.connect( ( '<broadcast>', 1617 ) )
>
> The exception I get is:
>
> socket.error: (13, 'permission denied')

Sending broadcast packets is a dangerous thing and not
something a normal user should be able to do. In a real OS,
it's a restricted operation and you need special privledges.

Under Linux, you need to be root to send a broadcase packet.

-- 
Grant Edwards                   grante             Yow!  How's the wife? Is
                                  at               she at home enjoying
                               visi.com            capitalism?



More information about the Python-list mailing list