python broadcast socket

G

Guest

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')


I have tried this on three Linux machines. All firewall software is disabled.


Thanks for you time and patience.

Ron
 
G

Grant Edwards

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,260
Messages
2,571,308
Members
47,956
Latest member
AmeeBerger

Latest Threads

Top