Click to See Complete Forum and Search --> : How do I get the IP address of a Local System


Harsha
May 4th, 1999, 03:55 PM
I need to get the IP address of the System in C or C++

May 4th, 1999, 03:58 PM
128.0.0.1

May 4th, 1999, 04:36 PM
What the answer is yours... ???
I want a C code which gives the Ip address of a system!

broc
May 4th, 1999, 07:12 PM
there is a dedicated address for local hosts and it's 127.0.0.1 not 128.0.0.1 as i've seen in the first reply. it's usualy used for tests. if you are looking for something about your computer not a simply IPaddress use 'getenv(<arg>)' where <arg> could be 'REMOTE_ADDR' (for your question) or some other enviroment variable. to find all specific enviroment variable for your computer just travers '_environ' which has 'char**' type.
use 'char** myEnv = _environ; while(*myEnv){ ...myEnv++} ' etc. ...

May 4th, 1999, 07:38 PM
I think he was referring to a perl CGI script.

Anarchos