Broadcasting IP of the Arduino to local Network

Hey guys!

I'm new to networking and currently trying to figure out the best way to approch my project, so some help would be glady appreciated :-)

I want to connect the arduino to a PC, where there's a software running which allows the sketch on the arduino to be manipulated. They are connected with an Ethernet cable. This is already working, but only with fixed IP adresses in the sketch - however, I want the arduino to be able to work with different PCs.

My current idea is to let the arduino broadcast its IP to the local Network using the Broadcast IP until the PC responds. After this happened, the PC should send ist own IP for ocmmuncation so the broadcast stops.

I am thinking about broadcasting using UDP ( found this link and this link that might be helpful for me), but I am not sure if this is the right approach and also don't know how to receive the IP of the PC once Connection has been established.

Following Hardware is used: - Arduino Leonardo - Ethernet Shield 2

I am thankful for any advice! :-)

what are you attempting to do? are you implementing your own client and server?

you can use UDP multicast to send to local machines https://github.com/esp8266/Arduino/issues/68

is there a reason why you don't use DHCP to get an IP address? https://www.arduino.cc/en/Reference/EthernetLocalIP

The Arduino is sending Input to the connected Computer, so I guess it's the server. (?)

I also read about Multicasting, but did not find too many helpful info explaining it to me. What is the difference to broadcasting and why is it better?

DHCP is not always supported, since there is not always a router connected to the Network.

never used broadcast - either unicast or multicast have a look at http://www.comptechdoc.org/independent/networking/guide/netbroadcasting.html

Thanks for the link, did not really consider Multicasting before. I'll try to get it to work using this method.

This topic can be closed, I think I'll post further questions in another section. :-)