Problem receiving UDP broadcast packets.
invalid at invalid.invalid
Wed Apr 20 02:09:09 CEST 2011
On 2011-04-19, Dan Stromberg <drsalists at gmail.com> wrote:
> On Tue, Apr 19, 2011 at 4:40 PM, Irmen de Jong <irmen.NOSPAM at xs4all.nl> wrote:
>> On 20-4-2011 1:21, Grant Edwards wrote:
>>> If I don't call bind(), then the broadcast packets go out the wrong
>>> interface on the sending machine.
>> Fair enough.
>> Next issue then: as far as I know, broadcast packets are by default not routed across
>> subnets by gateways. Which is a good thing.
>> That would explain why your receiver doesn't see the packets unless its interface IP
>> address is in the same subnet as the sender's.
>> However it doesn't explain (for me) why the tcpdump program running on that same
>> receiver machine still happily spits out received packets. Unless the routing between
>> the subnets is somehow done on the receiving machine itself? My knowledge of networks
>> and TCP/IP ends here I'm afraid.
> I'm guessing there are two different subnets on the same physical
Yes -- though technically they're on the same Ethernet segment rather
than physical cable, since there's an intervening Ethernet switch.
> - which is a little unusual, but not impossible.
OK, here's some background...
I'm trying to implement a device discovery/configuration protocol that
uses UDP broadcast packets to discover specific types of devices on
the local Ethernet segment. The management program broadcasts a
discovery command to a particular UDP port. All devices who get that
packet are expected to answer regardless of thier current IP address.
The management program can then send another broadcast packet to
configure the IP address of a device. After that, the management
program switches over to normal unicast TCP and UDP protocols (HTTP,
TFTP, etc.) to set up the device.
I had ignorantly assumed that an UDP broadcast sent to IP address
255.255.255.255 would be received by everybody who could hear it.
Apparently I'm going to have to use RAW packets and implement UDP
Grant Edwards grant.b.edwards Yow! BELA LUGOSI is my
at co-pilot ...
More information about the Python-list