Hey there,
On Feb 17, 2009, at 4:09 AM, Sai Pullabhotla wrote:
The getClientAddress returns the IP Address of the client that
connected/logged into the server. If the client used a Router to
connect to
the server over the Interner, the router's IP address is what the
server
will see as the connected client.
I'm not sure on your second question as I do not see a
getHostAddress()
method in the FTPSession. Please clarify further.
Oops, I meant FTPSession.getServerAddress.
Here's the behavior that I see for each, using this basic flow (please
correct me if I have over simplified things and that I'm wrong in
describing it this way):
Server's Local IP (1.1.1.1) <-NAT-> Server's External IP (2.2.2.2) <--
> User's router/public IP (3.3.3.3) <-NAT-> User's local IP (4.4.4.4)
FTPSession.getClientAddress: Server's External IP (2.2.2.2)
FTPSession:getServerAddress: Server's Local IP (1.1.1.1)
I would've expected FTPSession.getClientAddress to return User's
router/public IP of 3.3.3.3. I suppose it returns 2.2.2.2 instead
because the server is behind a NAT/firewall, and the last IP that it
knows that it's coming from is the one immediately behind the NAT. Is
that correct?
Thanks!
Koichi
Thanks.
Sai Pullabhotla
Phone: (402) 408-5753
Fax: (402) 408-6861
www.jMethods.com
On Mon, Feb 16, 2009 at 7:13 PM, Koichi Tsunoda <[email protected]
>wrote:
Hey all,
It seems like if I do ftpSession.getClientAddress().toString() in
an Ftplet
methods (onLogin, etc.), it won't get the actual user's address for
me. I'm
wondering if that is because of NATs/Firewalls/etc., or if it's a
bug? It
seems to get the last address the "hop" came from, rather than the
original
origin.
On the side note, if I do ftpSessoin.getHostAddress().toString(),
it'll get
the internal IP, rather than the external IP address that the user
used to
ftp to that machine. Is that also behaving the way it's supposed to
work?
Thanks!
Koichi