C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi ,

Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program

You might find arping useful. arping -d can catch duplicate responses when you ask what MAC address has an IP.

thanks corona , but that looks like a linux command .. is there a c library function for the same functionality

It's open source. Download the source and read it.

It involves opening a raw network interface, then sending and receiving ARP packets and understanding their meaning. A bit more complicated than a single function sadly, unless you choose to use the command itself as intended.