Problem receiving UDP broadcast packets.

Dan Stromberg drsalists at gmail.com
Tue Apr 19 19:40:03 EDT 2011


On Tue, Apr 19, 2011 at 3:21 PM, Grant Edwards <invalid at invalid.invalid> wrote:
> I'm have problems figuring out how to receive UDP broadcast packets on
> Linux.
>
> Here's the receiving code:
>
> ------------------------------receive.py-------------------------------

> But, the receiving Python program never sees any packets unless the
> _source_ IP address in the packets is on the same subnet as the
> receiving machine.

This is just how broadcasts work.

Normally, you take your subnet mask and "bitwise and" it with the IP
addresses of the sending and receiving machines.  If the results match
for two such pairs on two different machines, then the broadcast
should be visible, given appropriate code.

However, some routers have the ability to pass packets from one subnet
to another.  I believe this is called a "helper", at least in the
Cisco world, and must be configured specially.



More information about the Python-list mailing list