[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C code to find interface IP address



On Mit, 2003-03-19 at 12:36, mtsouk@freemail.gr wrote:
> I am looking for C code in order to find the IP address of each ethX
> interface in a Linux machine.

just take a look at the SIOCGIFADDR ioctl. You can use SIOCGIFNETMASK 
and SIOCGIFBRDADDR to find out the netmask and broadcast, too.

 -Andreas

-- 
Andreas Liebe/Darmstadt University of Technology/+49 6151 16-3150/3050(FAX)

Fata volentem ducunt, nolentem trahunt. (Seneca)



Reply to: