Re: ipaddr -> device
From: David Schwartz (davids_at_webmaster.com)
Date: 05/20/04
- Next message: Kasper Dupont: "Re: ipaddr -> device"
- Previous message: Andy MacLean: "Re: HELP: gettimeofday() jumps backwards"
- Next in thread: Kasper Dupont: "Re: ipaddr -> device"
- Maybe reply: Kasper Dupont: "Re: ipaddr -> device"
- Maybe reply: Tauno Voipio: "Re: ipaddr -> device"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 May 2004 05:50:30 -0700
Mike - EMAIL IGNORED wrote:
> On RedHat 9, programming in C++, on a machine that
> has several ethernet cards, I need to determine the
> device (eth0, eth1, etc.) from the ip address
> (192.168.1.10, etc.). Is there a function that
> will do this?
>
> Thanks in advance for your help.
>
> Mike.
SIOCGIFNAME. You need the interface index first. I think you can bind to
the IP address (assuming it's local), and then call SIOCGIFINDEX to get the
index.
DS
- Next message: Kasper Dupont: "Re: ipaddr -> device"
- Previous message: Andy MacLean: "Re: HELP: gettimeofday() jumps backwards"
- Next in thread: Kasper Dupont: "Re: ipaddr -> device"
- Maybe reply: Kasper Dupont: "Re: ipaddr -> device"
- Maybe reply: Tauno Voipio: "Re: ipaddr -> device"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]