suppose I am working on a multiple network interface machine and doing socket programming. The code runs
sockfd =socket(AF_INET,SOCK_STREAM,0);
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = inet_addr("");
bind(listenfd,(struct sockaddr *)&servaddr,sizeof(servaddr));
I want to ask how the kernel resolve that a particular IP address is given to a particular interface..Is it that kernel refers to a system file that stores a mapping from IP address to network interface. Can you please tell me where that file is stored in case of Red Hat 9 linux version 2.4.x>=20.

In case the interfaces pickup the IP addresses from dhcp , from where the machine gets the address of dhcp server at time of booting ?? and where the IP address got stored after the machine gets IP address.?