I am not sure if this is the right place for this question, but since I write my application in C++ I thought to post it here.

I am developing an application to communicate with my network device. I used UDP classes to search the device from the network.

I done the code in such a way that from my application a broadcast message will send to the local network. The device will respond to the broadcast message and the application will get the IP address from that response. after establishing a network communication send a message to the device for changing the IP address. That worked fine if my devices IP address is correct.

But when I set a wrong IP address and subnet to the device. My application will never get any messages from the device. So I can't able communicate to the device and not able get the device and unable to change the IP address etc.

Say example
IP address of the device
Subnet Mask

And in my system that runs the application

IP addres
Subnet Mask

I tried the Lantronix device installation software with their Lantronix device in network. It listed the device from the network and I am able to change the IP address from their software.

Any one know how this is done in this type of software? How I can search in network to find the device and change the IP address when its IP address is not in range? Which protocol they used to find the device?