[PLUG] getting IP address of host
Fred James
fredjame at fredjame.cnc.net
Wed Apr 30 18:13:58 UTC 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
>
>
Wayne E. Van Loon Sr
grep `hostname` /etc/hosts | awk '{ print($1) }'`
... maybe?
Regards
Fred James
More information about the PLUG
mailing list