Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Problem receiving UDP broadcast packets. Date: Wed, 20 Apr 2011 00:09:09 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 52 Message-ID: References: <4dae172e$0$65870$e4fe514c@news.xs4all.nl> <4dae1d82$0$81483$e4fe514c@news.xs4all.nl> NNTP-Posting-Host: dsl.comtrol.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reader1.panix.com 1303258149 10786 64.122.56.22 (20 Apr 2011 00:09:09 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 20 Apr 2011 00:09:09 +0000 (UTC) User-Agent: slrn/pre0.9.9-102 (Linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3617 On 2011-04-19, Dan Stromberg wrote: > On Tue, Apr 19, 2011 at 4:40 PM, Irmen de Jong 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 > cable 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 myself. :/ -- Grant Edwards grant.b.edwards Yow! BELA LUGOSI is my at co-pilot ... gmail.com