tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Getting the tomcat server IP
Date Mon, 23 Feb 2009 00:53:56 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yuval,

On 2/21/2009 1:44 PM, Yuval Perlov wrote:
> Also, from the socket object you can always call
> socket.getLocalAddress() on an outgoing connection. This is useful if
> you want to make sure you are getting the IP for a particular network.

Aren't we going around in circles, here? The OP can't use
getLocalAddress because there are multiple interfaces on the server.
There is no reference to the socket to get the local address from. There
is no request to get the local address from.

Your suggestion to make an outgoing connection won't work, either,
because there's no guarantee that the outgoing connection's IP is the
"right one".

The only way to find out what the correct IP address is to grab the
running Connector from memory and interrogate it. This could possibly be
done using JMX, but I'm no expert at what parts of Tomcat are available
via JMX.

I suppose you could also attempt to manually parse the server.xml file
looking for the <Connector> definition. Then again, you might get the
wrong connector if multiple <Connectors> are defined.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmh86QACgkQ9CaO5/Lv0PAf/wCfeMZe6952CL21pheyG0KIx8KJ
g8sAn1isim1vxPk60bukHIjAw35McV9k
=54vn
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message