All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christopher Friesen" <cfriesen@nortelnetworks.com>
To: linux-kernel@vger.kernel.org
Subject: how to get IP address of current machine from C++ code?
Date: Fri, 03 Nov 2000 12:37:08 -0500	[thread overview]
Message-ID: <3A02F7C4.E140D608@nortelnetworks.com> (raw)
In-Reply-To: <200010210246.WAA08580@smarty.smart.net>

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/

       reply	other threads:[~2000-11-03 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200010210246.WAA08580@smarty.smart.net>
2000-11-03 17:37 ` Christopher Friesen [this message]
2000-11-03 21:09   ` how to get IP address of current machine from C++ code? David Ford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3A02F7C4.E140D608@nortelnetworks.com \
    --to=cfriesen@nortelnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.