LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-27-2006, 05:18 PM   #1
allomeen
Member
 
Registered: Dec 2005
Posts: 83

Rep: Reputation: 15
find ip address of my computer in C/C++


Hello Everyone,

How can I get my machine IP address programmatically using C++ or C. Is there any function that can give me the IP or some info with it and I parse the IP from it?

I was thinking to open one of the files that contain the ip address and parse it out, but it looked like there are something simpler to get the ip.

Thanks in advance,
Alaa G
 
Old 04-27-2006, 06:51 PM   #2
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
You can use gethostbyname() to do this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find the ip address of a computer that is connected to LAN gajaykrishnan Linux - Networking 7 12-03-2010 05:38 AM
Why Scourge (2nd computer) isn't getting ip address from Misery (1st computer) dhcp? pslave Linux - Networking 2 04-09-2006 05:58 AM
How to find an IP address from the MAC address of a remote machine ? jitz Linux - General 3 01-03-2006 07:55 AM
how to find my computer address? mfrangos79 Linux - Newbie 9 11-09-2005 05:20 PM
How to find IP address of a machine if I know their MAC Address dysenteryduke Linux - Networking 13 09-12-2005 10:21 AM


All times are GMT -5. The time now is 11:02 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration