Your server asks the client (Filezilla or your Java code) to connect to internal IP address 192.168.1.56
for data transfer.
FileZilla guesses that the server is behind firewall/port forwarding/whatever (not speaking German, but I believe this is what the "Vom Server gesendete Addresse..." line says). So FileZilla disregards the request and connects to the server's external IP address instead (92.105.*
, note that you forgot to obfuscate the IP in the log).
While your Java client throws an error in this situation.
Checking the source code of Apache FTPClient, it seems that it should be doing the same as FileZilla, at least since 3.1. What version are you using?
/**
* @since 3.1
*/
protected void _parsePassiveModeReply(String reply)
throws MalformedServerReplyException
{
java.util.regex.Matcher m = __PARMS_PAT.matcher(reply);
if (!m.find()) {
throw new MalformedServerReplyException(
"Could not parse passive host information.\nServer Reply: " + reply);
}
__passiveHost = m.group(1).replace(',', '.'); // Fix up to look like IP address
try
{
int oct1 = Integer.parseInt(m.group(2));
int oct2 = Integer.parseInt(m.group(3));
__passivePort = (oct1 << 8) | oct2;
}
catch (NumberFormatException e)
{
throw new MalformedServerReplyException(
"Could not parse passive port information.\nServer Reply: " + reply);
}
try {
InetAddress host = InetAddress.getByName(__passiveHost);
// reply is a local address, but target is not - assume NAT box changed the PASV reply
if (host.isSiteLocalAddress()) {
InetAddress remote = getRemoteAddress();
if (!remote.isSiteLocalAddress()){
String hostAddress = remote.getHostAddress();
fireReplyReceived(0,
"[Replacing site local address "+__passiveHost+" with "+hostAddress+"]\n");
__passiveHost = hostAddress;
}
}
} catch (UnknownHostException e) { // Should not happen as we are passing in an IP address
throw new MalformedServerReplyException(
"Could not parse passive host information.\nServer Reply: " + reply);
}
}
Alternatively, you may be able to tell (configure) your server what is its external IP address, so that it uses that instead of the internal IP address.