I am building a utility to communicate with some hardware that comes with a default IP address of 10.0.0.1 and subnet mask 255.255.255.0. The hardware replies to UDP messages on the same IP and port they originated from (not the port received on). I have a socket setup to send a broadcast UDP message and then listen for replies from any IP.
The problem I am having is that when my Windows 7 machine is on an IP received from my router via DHCP (as most of our users will be), I only receive responses from devices previously configured to be on the same subnet (192.168.1.XXX), and get nothing from a new device on the default 10.0.0.1.
However, I discovered (by accident) that if I reconfigure Windows with a manually assigned IP (10.0.0.2) and no other changes, I am suddenly able to receive messages from ALL devices, from any subnet. This makes me think my code is ok but that I'm missing something in regards to how DHCP or Windows handles UDP responses. Is anyone able to shed some light on what I need to do to make this work?
Thank you in advance!
Desktop PC is connected to the router via a wired NIC. All the other devices are connected to one switch which is also connected straight to the router. When PC is configured in Windows to get an IP automatically it receives 192.168.1.112. Two of the devices are manualy set to 192.168.1.XXX addresses, and the third is at its default of 10.0.0.1. The devices do not have a DHCP mode.
Another note: regardless of whether the PC is in DHCP or a static IP, I have confirmed that the broadcast messages DO reach the device on the other subnet (10.0.0.1). This is verified by the fact that the devices respond appropriately to the commands I send. The problem lies completely in the device's network response making it back to my application. I don't know if it's Windows or my application blocking the response, but I don't think it's the router because I can get responses when I give my PC a static IP without changing anything else on the network.