[PLUG] getting IP address of host

Sandy Herring sandy at herring.org
Wed Apr 30 16:40:19 UTC 2008


Circa 18:47:18 on Mon, 28 Apr 2008, Wayne E. Van Loon Sr. wrote: 
> Hello:
> I often have programs that operate a server and one or more clients on a 
> local network. I have always had a data file on my server with the 
> address at which my server is to listen (the port is hard coded). When I 
> move the program to another computer, I need to change my IP address 
> data file. I would like to modify my program to get the IP address of 
> it's host not knowing the host name. Any ideas?
> Thanks,
> Wayne

You should be able to parse it from the stdout of /sbin/ifconfig. I
don't have a system with 2 NIC's, so I don't know how much complexity
that would introduce (in the event that's a concern for you).

Sandy

-- 
Sandy Herring, RHCE                        o              sandy at herring.org
Peck of Pickled Pisces               __  o               http://herring.org/
*nix || Web authoring questions?  |\/ o\  o  http://herring.org/finger.html
->http://herring.org/techie.html  |/\__/     http://herring.org/pub-key.asc



More information about the PLUG mailing list