[PLUG] getting IP address of host

Tim Garton garton.tim at gmail.com
Wed Apr 30 19:24:40 UTC 2008


Is there some reason you want the server piece to bind to a specific
IP?  Most languages/network libraries will allow you to either bind to
all IPs or bind to "0.0.0.0" which will cause the server to listen on
all interfaces/all IPs.  If you're worried about security you can then
use iptables to block incoming requests to IPs you don't want to
service, but it sounds like you are running this on a local network so
it wouldn't be an issue anyway.

Tim

On Mon, Apr 28, 2008 at 6:47 PM, Wayne E. Van Loon Sr.
<wevl at pacifier.com> 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
>
>  _______________________________________________
>  PLUG mailing list
>  PLUG at lists.pdxlinux.org
>  http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list