473,545 Members | 319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

python broadcast socket

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_DGR AM )
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

Jul 19 '05 #1
2 3134
On 2005-06-29, <ro****@cox.net > <ro****@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_DGR AM )
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?
Jul 19 '05 #2
Grant Edwards wrote:
Under Linux, you need to be root to send a broadcase packet.


I don't think this is true.

--Irmen
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
11845
by: Stephan Steiner | last post by:
Hi The project I'm currently working on involves sending large UDP broadcasts. As the .NET framework already provides an easy facility for sending and receiving UDP packets I thought it was a good idea to use UdpClient rather than sockets directly. A few weeks back I ended up rewriting the receiver part to use sockets directly because I had...
6
10296
by: pekspro | last post by:
I need some code that gets the address from a server. I read somewhere that you could do this by starting some broadcast server using UDP. The client should send an broadcast message, and when the server answering the client gets the address. But how do I implement this? I did this simple quick-hack: Server: Socket server = new...
8
46072
by: Frank Esser | last post by:
Hello! I have got machines that answer a certain UDP broadcast request with certain information about them. Some years ago I wrote a VB6 application that just sent out this UDP broadcast request and received all machine information to display all available machines in a grid. Now I want to write the same application in C# but so far...
1
2001
by: Dave | last post by:
I can't figure out why my code does not recieve the message. The only message that it receives is the one going out from my machine. I am suppose to send out a message to a server. Upon receiving that message on the server side the server is suppose to send a message back. I can't get my app to receive that message. It only receives the...
2
6581
by: Gunnar_Frenzel | last post by:
Hello, this might be an easy question, but I don't have any handy solution at hand. I have an application that is supposed to send UDP broadcast. So far so easy, I did: Socket sockSendBroadcast = null; IPEndPoint ipeSendBroadcast = null; ipeSendBroadcast = new IPEndPoint(IPAddress.Broadcast, iSomePort);
3
3642
Sagittarius
by: Sagittarius | last post by:
Hi there. I have a problem concerning an UDP socket in C++ (Winsock). The next paragraphs is merely to explain the system I am working on. If U want to skip it, I have marked the question in bold below it. I have a pc, connected to a network of boards, all connected in a ring, all having their own unique IP adresses. As it is now, I send...
1
1803
by: sajaisosa | last post by:
Hey there I've been following through the book "Beginning Python from Novice to Professional", and I have learned a great deal. At the moment, I am trying to expand upon the chatroom project near the end of this book. My problem, is that I can't get my head around how to allow the users to add new rooms. At the moment, there is only one room....
1
11787
by: Larry.Martell | last post by:
I am trying to send UDP broadcast packets over a specific interface and I am having trouble specifying the interface: host='192.168.28.255' sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('',0)) sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF,...
2
6519
by: OBones | last post by:
Hi all, I'm currently trying to receive replies to a UDP broadcast that I sent and I can't get it to work. I know the datagrams are sent as I see them with WireShark, but my C# code does not see them. Here is how I intended things to work: Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); try
0
7457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7391
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7746
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5962
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.