2011-01-11 09:49:35     How to get ip address

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-01-11 09:49:35     How to get ip address

Emil Bart (POLAND)

Message: 97345   

 

Hello,

 

I have two questions:

 

1. Is there another way to retrieve ip address of proper interface in user space (from application) than the following:

 

ioctl (sock, SIOCGIFADDR, &ifred);

 

Maybe is there a file in uCLinux where there are stored ip addresses of all interfaces ? Unfortunatelly I couldn't find it.

 

2. How can I check in c application if network interface exists and is active (have assigned ip address) in uCLinux.

 

 

 

Thanks for any help

 

emilbart,

QuoteReplyEditDelete

 

 

2011-01-11 10:59:17     Re: How to get ip address

Mike Frysinger (UNITED STATES)

Message: 97346   

 

use SIOCGIFCONF to get all interfaces, and SIOCGIFADDR to get the addresses assigned to an interface

QuoteReplyEditDelete

Attachments

    Outcomes