On 16 Mar 14:20, Mark Rogers wrote:
On 16/03/12 13:40, Brett Parker wrote:
Are you *sure* that there is going to be a return packet, and that your send packet *definitely* arrived at the other end?
I'm as sure as I can be that it gets there, and it should definitely illicit a response. However, see later follow-up: I needed to bind to port 9600 to receive it.
I'd like to understand why this is though, given that it wasn't necessary for receiving the error messages.
The equiv in python is something like:
Thanks, it's more elegant than the code I hacked together!
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.settimeout(4)
These look like configuration steps I should look into though.
I should probably admit to the code having mostly been stolen from when I wrote some discovery tools having wiresharked the traffic sent from the windows apps, and so I had that code kicking about on the laptop already - and in that, too, you had to be bound to the right port else you didn't get a response :)
(The code in question will, mostly, just about, detect cheap managed netgear switches and cheap ip power devices... I never did get the time to finish it and make it neat, or debug why it didn't work for someone else... broadcast UDP packets are fun though, and getting responses back from more than one place is also fun :)