I am developing an embedded system and very new to this TCP\IP. My problem is that once I installed my board in a local network and this board will acquire its IP address dynamically, it has to communicate with a client application running on one of the PC(other than DHCP server) in the network. To communicate with this new board the client application is required to know the IP address of the board. What is the way to know the IP address of the board? Will UDP broadcast work for this purpose? If yes please, explain in detail as I am unable to understand it. Please provide me some sample code in C if possible.
Share
The basic idea is:
SO_BROADCASTsocket option withsetsockopt(). It then callsrecvfrom()to wait for packets in a loop.SO_BROADCASTsocket option and sends a “discovery” type packet to the well-known port and the local broadcast address.recvfrom(), recording the address of each.