Hi Avni, Thanks for the response. Just now i started going through the ifconfig source code. I think they are parsing the /proc/net/dev file and finding the interfaces list. In this method i hope based on the parsing condition we can find out the aliases as well. Is that right. But using proc will become more OS specific. Your method looks pretty good. I will try that. Thanks, Ramesh. Avniwb wrote: > well...here u r.... > ------------------------------------- > > struct ifreq ifrs[MAX_INTERFACES]; > struct ifconf ifcnf; > > ifcnf.ifc_len = sizeof(ifrs); > ifcnf.ifc_req = ifrs; > > ioctl(sd, SIOCGIFCONF, &ifcnf); > > ------------------------------------- > > and then... > ------------------------------------- > > ( ifcnf.ifc_len / sizeof(struct ifreq) ); > > ------------------------------------- > > should get you the number of interfaces... :-) > > Warning:: Be careful about aliases also...i mean MAX_INTERFACES should > consider that as well..... > > don't know whether there's any other way where without specifying > MAX_INTERFACES should also do... !! :-) > > Avni > > -----Original Message----- > From: linux-net-owner@vger.kernel.org > [mailto:linux-net-owner@vger.kernel.org]On Behalf Of S Ramesh > Sent: Monday, 4 March 2002 2:11 PM > To: Net > Subject: interface details > > Hi, > > I am doing to a protocol implementation and I want to know the number > of interfaces exist in my box and its details when my code gets > initialised. How can i acheive it. I saw the ifreq structure, but > again when we give some interface name of ifindex we can get the > details, but how to know the total number of interfaces exist in my > box. Any pointers will be very muchappreciated. > > Thanks, > Ramesh > > - > : send the line "unsubscribe linux-net" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > > - > : send the line "unsubscribe linux-net" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html