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!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Problem receiving UDP broadcast packets. Date: Tue, 19 Apr 2011 23:21:26 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 31 Message-ID: References: <4dae172e$0$65870$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 1303255286 28075 64.122.56.22 (19 Apr 2011 23:21:26 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 19 Apr 2011 23:21:26 +0000 (UTC) User-Agent: slrn/pre0.9.9-102 (Linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3602 On 2011-04-19, Irmen de Jong wrote: > On 20-4-2011 0:21, Grant Edwards wrote: >> I'm have problems figuring out how to receive UDP broadcast packets on >> Linux. >> > [...] > >> Here's the sending code: >> >> --------------------------------send.py------------------------------- >> #!/usr/bin/python >> import sys,socket,time >> >> host = sys.argv[1] >> port = 5010 >> >> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) >> s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) >> s.bind((host,port)) > > I don't think you should use s.bind() at all in the sending code. > Could that be at least part of the problem? If I don't call bind(), then the broadcast packets go out the wrong interface on the sending machine. -- Grant Edwards grant.b.edwards Yow! Vote for ME -- I'm at well-tapered, half-cocked, gmail.com ill-conceived and TAX-DEFERRED!