lkml.org 
[lkml]   [2000]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjecthow to get IP address of current machine from C++ code?
I would like to get the IP address of one of the interfaces of the
machine that I'm currently on from within some C++ code. It looks like
I should be able to do this by doing an

ioctl(atoi(fd, SIOCGIFADDR, &ifr)

with the interface name set in the appropriate field in ifr, but I'm not
sure how I should be getting the proper value for fd. I would
appreciate some help on this, or if there is a better way then I'd love
to hear it.

Thanks,

Chris


--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.052 / U:0.032 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site