[Catalyst] How to get IP address of the interface which the request come through

N.A. n-a at u01.gate01.com
Sun Mar 24 00:28:20 GMT 2013

 > Interesting.  What's your use case here?

Not a quite common use case.

I make a configuration generation site for Google-android apps.
Each user access the site from their own PC's to generate a 
configuration file, and then send the config file to android terminals 
over the USB connection.

In my environment, users usually use just a hostname (not a FQDN)
with the help of DNS default search-domain setting.
So they will access URL like 'http://configserver/mk_config', not
a 'http://configserver.domain.co.jp/mk_config.'

However, android OS seems ignore default search-domain setting assigned 
by DHCP server, so android-terminals can not resolve IP address
of 'configserver'. (Of course , they can resolve 
'configserver.domain.co.jp' to  IP address)

This is why I prefer IP's address over hostnames in this situation.

I'm afraid my 'localhost' example is not a appropriate and make you
confused as though I want to resolve 'localhost' to ''.
Pardon me if this is the case.


(2013年03月24日 03:08), Bill Moseley wrote:
> On Sat, Mar 23, 2013 at 7:31 AM, N.A. <n-a at u01.gate01.com
> <mailto:n-a at u01.gate01.com>> wrote:
>     (2013年03月23日 23:03), Peter Flanigan wrote:
>      > On 23/03/13 12:12, N.A. wrote:
>      >> I wan to get the  IP address of the interface(network device)
>     which the
>      >> request come through.
>      >
>      > My bad.
>      >
>      > Use $c->req->uri->host to get the hostname of the server
>      >
>     Sorry, $c->req->uri->host is 'hostname', not a IP.
>     I want to get  IPv4 address like '' even if I access the page
>     by 'http://localhost/XXX'
> Interesting.  What's your use case here?
> --
> Bill Moseley
> moseley at hank.org <mailto:moseley at hank.org>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

More information about the Catalyst mailing list