Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3634
| References | (3 earlier) <4dae1d82$0$81483$e4fe514c@news.xs4all.nl> <mailman.592.1303257124.9059.python-list@python.org> <iol875$ah2$3@reader1.panix.com> <mailman.596.1303260785.9059.python-list@python.org> <iolc32$luj$1@reader1.panix.com> |
|---|---|
| Date | 2011-04-19 20:12 -0700 |
| Subject | Re: Problem receiving UDP broadcast packets. |
| From | Dan Stromberg <drsalists@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.604.1303269150.9059.python-list@python.org> (permalink) |
On Tue, Apr 19, 2011 at 6:15 PM, Grant Edwards <invalid@invalid.invalid> wrote: >> Or can you simply use a stupid netmask like /1 that picks up all the >> IP ranges? That way, the source-IP check wouldn't fail. > > That would require that the device somehow knows that it's not > configured correctly and should change the netmask to /1. The device > doesn't have any way to know that, and it must respond to the > discovery commands both before and after it's properly configured. - Actually, you Might be able to configure your device to have a netmask of 0.0.0.0, IP address of 255.255.255.255 and broadcast of 255.255.255.255. - I've seen something a bit similar used for detecting IP address conflicts automatically. - A network guru I used to work with told me that you could configure a machine with a broadcast of 255.255.255.255 more simply than messing around with the netmask, while still achieving the same result for general purpose networking. > I've reread the protocol documentation and noticed that the device has > to respond not only to broadcasts to 255.255.255.255 but also to > subnet broadcasts send to subnets it's not on. That pretty much > clinches the requirement to use a raw socket. :/ With a netmask of 0.0.0.0, I suspect you will receive all broadcasts on the wire, given appropriate listening code. You could probably also modify a copy of tshark or tcpdump to flush after every line of output (or run an unmodified one on a pty to avoid maintaining your own copy of the binary), and parse that output in Python. That should make the Python code pretty simple. There's an old program called "pty" that makes it easy to run something on a pty, to get unbuffered output - it's in comp.sources.unix volumes 22, 23 and 25; it's written in C. You'd just open a subprocess with no buffering on the python side, that runs tcpdump or tshark under pty. Beware though - the pty program predates GNU autoconf, so might be a little involved to compile. I agree though that you're kind of pushing IP in a direction it wasn't intended to go.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-19 22:21 +0000
Re: Problem receiving UDP broadcast packets. Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-04-20 01:13 +0200
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-19 23:21 +0000
Re: Problem receiving UDP broadcast packets. Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2011-04-20 01:40 +0200
Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 16:52 -0700
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 00:09 +0000
Re: Problem receiving UDP broadcast packets. Chris Angelico <rosuav@gmail.com> - 2011-04-20 10:53 +1000
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 01:15 +0000
Re: Problem receiving UDP broadcast packets. Chris Angelico <rosuav@gmail.com> - 2011-04-20 11:24 +1000
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 03:05 +0000
Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 20:12 -0700
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:31 +0000
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:42 +0000
Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 20:16 -0700
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:21 +0000
Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-20 18:35 -0700
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-21 14:22 +0000
Re: Problem receiving UDP broadcast packets. Heiko Wundram <modelnine@modelnine.org> - 2011-04-21 08:22 +0200
Re: Problem receiving UDP broadcast packets. Roy Smith <roy@panix.com> - 2011-04-19 23:35 -0400
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:23 +0000
Re: Problem receiving UDP broadcast packets. Sherm Pendley <sherm.pendley@gmail.com> - 2011-04-20 06:07 -0400
Re: Problem receiving UDP broadcast packets. Adam Tauno Williams <awilliam@whitemice.org> - 2011-04-20 06:20 -0400
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:37 +0000
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-19 23:54 +0000
Re: Problem receiving UDP broadcast packets. Heiko Wundram <modelnine@modelnine.org> - 2011-04-20 08:45 +0200
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:30 +0000
Re: Problem receiving UDP broadcast packets. Heiko Wundram <modelnine@modelnine.org> - 2011-04-20 16:53 +0200
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:24 +0000
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:32 +0000
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 15:50 +0000
Re: Problem receiving UDP broadcast packets. Dan Stromberg <drsalists@gmail.com> - 2011-04-19 16:40 -0700
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 00:00 +0000
Re: Problem receiving UDP broadcast packets. Chris Angelico <rosuav@gmail.com> - 2011-04-20 10:32 +1000
Re: Problem receiving UDP broadcast packets. Thomas Heller <theller@ctypes.org> - 2011-04-20 12:18 +0200
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 14:35 +0000
Re: Problem receiving UDP broadcast packets. Grant Edwards <invalid@invalid.invalid> - 2011-04-20 22:25 +0000
csiph-web