Problem receiving UDP broadcast packets.

Grant Edwards invalid at invalid.invalid
Thu Apr 21 00:25:49 CEST 2011


On 2011-04-19, Grant Edwards <invalid at invalid.invalid> wrote:

> I'm have problems figuring out how to receive UDP broadcast packets on
> Linux.

Thanks to everybody for their help with what turned out to have little
or nothing to do with Python itself.

The main problem was reverse-path filtering (which is enabled by
default on Linux). Disabling it allowed me to receive packets sent to
255.255.255.255 regardless of the sender's IP address.

Another minor issue that cropped up was that I ended up having to use
two sockets: an Rx socket bound to ('',port) and a Tx socket bound to
(myip,port).

Even though the protocol spec said that subnet broadcasts were used,
tracing a few transactions between existing implementations showed
that only global broadcasts were used. More testing showed that
existing implementations won't respond to subnet broadcasts unless
they're already configured to be on the proper subnet.  So, receiving
subnet broadcasts that don't match an interface turned out to be a
wild goose chase.

It's all working now...

-- 
Grant Edwards               grant.b.edwards        Yow! Everywhere I look I
                                  at               see NEGATIVITY and ASPHALT
                              gmail.com            ...



More information about the Python-list mailing list